| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. | 4 found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <link rel="import" href="../lib/net.html"> | 7 <link rel="import" href="../lib/net.html"> |
| 8 <link rel="import" href="../lib/update-util.html"> | 8 <link rel="import" href="../lib/update-util.html"> |
| 9 <link rel="import" href="ct-builder-revisions.html"> | 9 <link rel="import" href="ct-builder-revisions.html"> |
| 10 <link rel="import" href="ct-failure.html"> | 10 <link rel="import" href="ct-failure.html"> |
| 11 <link rel="import" href="ct-failure-group.html"> | 11 <link rel="import" href="ct-failure-group.html"> |
| 12 <link rel="import" href="ct-sheriff-failure-group-data.html"> | 12 <link rel="import" href="ct-sheriff-failure-group-data.html"> |
| 13 <link rel="import" href="ct-trooper-failure-group-data.html"> | 13 <link rel="import" href="ct-trooper-failure-group-data.html"> |
| 14 <link rel="import" href="ct-commit-list.html"> | 14 <link rel="import" href="ct-commit-list.html"> |
| 15 | 15 |
| 16 <script> | 16 <script> |
| 17 function CTFailures(commitLog) { | 17 function CTFailures(commitLog) { |
| 18 this.commitLog = commitLog; | 18 this.commitLog = commitLog; |
| 19 this.builderLatestRevisions = null; | 19 this.builderLatestRevisions = null; |
| 20 // Maps a tree id to an array of CTFailureGroups within that tree. | 20 // Maps a tree id to an array of CTFailureGroups within that tree. |
| 21 this.failures = null; | 21 this.failures = null; |
| 22 this.lastUpdateDate = null; | 22 this.lastUpdateDate = null; |
| 23 | |
| 24 // FIXME: Get this from | |
| 25 // https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/sla
ve/gatekeeper_trees.json?format=text. | |
| 26 this._trees = { | |
| 27 blink: [ | |
| 28 "https://build.chromium.org/p/chromium.webkit", | |
| 29 ], | |
| 30 chromium: [ | |
| 31 "https://build.chromium.org/p/chromium", | |
| 32 "https://build.chromium.org/p/chromium.chrome", | |
| 33 "https://build.chromium.org/p/chromium.chromiumos", | |
| 34 "https://build.chromium.org/p/chromium.gpu", | |
| 35 "https://build.chromium.org/p/chromium.linux", | |
| 36 "https://build.chromium.org/p/chromium.mac", | |
| 37 "https://build.chromium.org/p/chromium.memory", | |
| 38 "https://build.chromium.org/p/chromium.win" | |
| 39 ], | |
| 40 }; | |
| 41 } | 23 } |
| 42 | 24 |
| 43 (function() { | 25 (function() { |
| 44 'use strict'; | 26 'use strict'; |
| 45 | 27 |
| 46 // FIXME: This could potentially move onto CTSheriffFailureGroupData as it isn't
relevant to | 28 // FIXME: This could potentially move onto CTSheriffFailureGroupData as it isn't
relevant to |
| 47 // trooper failures. | 29 // trooper failures. |
| 48 // Reverse sorting order, if a > b, return a negative number. | 30 // Reverse sorting order, if a > b, return a negative number. |
| 49 CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) { | 31 CTFailures.prototype._failureByTreeListComparator = function(tree, a, b) { |
| 50 if (tree === undefined) | 32 if (tree === undefined) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 79 return -1; | 61 return -1; |
| 80 | 62 |
| 81 if (a_list.last() != b_list.last()) | 63 if (a_list.last() != b_list.last()) |
| 82 return b_list.last() - a_list.last(); | 64 return b_list.last() - a_list.last(); |
| 83 } | 65 } |
| 84 return 0; | 66 return 0; |
| 85 }; | 67 }; |
| 86 | 68 |
| 87 // Updates the format of the alerts array to be easier to parse. | 69 // Updates the format of the alerts array to be easier to parse. |
| 88 CTFailures.prototype._mungeAlerts = function(alerts) { | 70 CTFailures.prototype._mungeAlerts = function(alerts) { |
| 89 var masterToTree = {}; | |
| 90 Object.keys(this._trees, function(tree, masters) { | |
| 91 masters.forEach(function(master) { | |
| 92 masterToTree[master] = tree; | |
| 93 }); | |
| 94 }); | |
| 95 | |
| 96 alerts.forEach(function(failure) { | 71 alerts.forEach(function(failure) { |
| 97 // FIXME: Have the server store the actual failure type in a different | 72 // FIXME: Have the server store the actual failure type in a different |
| 98 // field instead of smashing it into the reason. | 73 // field instead of smashing it into the reason. |
| 99 if (failure.failureType) { | 74 if (failure.failureType) { |
| 100 // The server has been fixed. | 75 // The server has been fixed. |
| 101 } else { | 76 } else { |
| 102 if (failure.reason) { | 77 if (failure.reason) { |
| 103 var parts = failure.reason.split(':'); | 78 var parts = failure.reason.split(':'); |
| 104 failure.reason = parts[0]; | 79 failure.reason = parts[0]; |
| 105 failure.failureType = parts[1] || 'FAIL'; | 80 failure.failureType = parts[1] || 'FAIL'; |
| 106 } else { | 81 } else { |
| 107 failure.failureType = 'UNKNOWN'; | 82 failure.failureType = 'UNKNOWN'; |
| 108 } | 83 } |
| 109 } | 84 } |
| 110 | |
| 111 // FIXME: Figure out what tree masters that aren't in masterToTree | |
| 112 // we should have. | |
| 113 failure.tree = masterToTree[failure.master_url]; | |
| 114 }); | 85 }); |
| 115 }; | 86 }; |
| 116 | 87 |
| 117 CTFailures.prototype.update = function() { | 88 CTFailures.prototype.update = function() { |
| 118 var annotationPromise = CTFailureGroup.fetchAnnotations(); | 89 var annotationPromise = CTFailureGroup.fetchAnnotations(); |
| 119 return Promise.all([annotationPromise, net.json('http://sheriff-o-matic.appspo
t.com/alerts'), | 90 return Promise.all([annotationPromise, net.json('http://sheriff-o-matic.appspo
t.com/alerts'), |
| 120 net.json('http://trooper-o-matic.appspot.com/alerts')]).then(function(data
_array) { | 91 net.json('http://trooper-o-matic.appspot.com/alerts')]).then(function(data
_array) { |
| 121 var annotations = data_array[0]; | 92 var annotations = data_array[0]; |
| 122 var sheriff_data = data_array[1]; | 93 var sheriff_data = data_array[1]; |
| 123 var trooper_data = data_array[2]; | 94 var trooper_data = data_array[2]; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 196 |
| 226 if (!newFailures[tree]) | 197 if (!newFailures[tree]) |
| 227 newFailures[tree] = []; | 198 newFailures[tree] = []; |
| 228 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision
s); | 199 var commitList = new CTCommitList(this.commitLog, rangeGroup.likely_revision
s); |
| 229 newFailures[tree].push(new CTFailureGroup(rangeGroup.sort_key, new CTSheriff
FailureGroupData(treeFailures, commitList))); | 200 newFailures[tree].push(new CTFailureGroup(rangeGroup.sort_key, new CTSheriff
FailureGroupData(treeFailures, commitList))); |
| 230 }.bind(this)); | 201 }.bind(this)); |
| 231 }; | 202 }; |
| 232 | 203 |
| 233 })(); | 204 })(); |
| 234 </script> | 205 </script> |
| OLD | NEW |