Chromium Code Reviews| 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="../model/ct-failure.html"> | 7 <link rel="import" href="../model/ct-failure.html"> |
| 8 | 8 |
| 9 <polymer-element name="ct-failure-analyzer" attributes="failures builderLatestRe visions"> | 9 <polymer-element name="ct-failure-analyzer" attributes="failures builderLatestRe visions"> |
| 10 <script> | 10 <script> |
| 11 // FIXME: Don't use a polymer component for this. Instead use a Failures mod el | 11 // FIXME: Don't use a polymer component for this. Instead use a Failures mod el |
| 12 // object that knows how to do the XHR and process the data appropriately. | 12 // object that knows how to do the XHR and process the data appropriately. |
| 13 Polymer({ | 13 Polymer({ |
| 14 builderLatestRevisions: {}, | 14 builderLatestRevisions: null, |
| 15 failures: {}, | 15 failures: null, |
| 16 | |
| 17 // FIXME: Get this from https://chromium.googlesource.com/chromium/tools/b uild/+/master/scripts/slave/gatekeeper_trees.json?format=text. | |
| 18 _trees: { | |
|
eseidel
2014/07/25 16:40:17
Isn't this just as simple as atob(xhr.responseText
ojan
2014/07/26 17:31:51
Pretty much. It needs doing the network request, a
| |
| 19 blink: [ | |
| 20 "https://build.chromium.org/p/chromium.webkit", | |
| 21 ], | |
| 22 chromium: [ | |
| 23 "https://build.chromium.org/p/chromium", | |
| 24 "https://build.chromium.org/p/chromium.chrome", | |
| 25 "https://build.chromium.org/p/chromium.chromiumos", | |
| 26 "https://build.chromium.org/p/chromium.gpu", | |
| 27 "https://build.chromium.org/p/chromium.linux", | |
| 28 "https://build.chromium.org/p/chromium.mac", | |
| 29 "https://build.chromium.org/p/chromium.memory", | |
| 30 "https://build.chromium.org/p/chromium.win" | |
| 31 ], | |
| 32 }, | |
| 16 | 33 |
| 17 update: function() { | 34 update: function() { |
| 18 net.json('http://auto-sheriff.appspot.com/data').then(function(data) { | 35 net.json('http://auto-sheriff.appspot.com/data').then(function(data) { |
| 19 // FIXME: Don't special-case the blink master. | 36 // FIXME: Don't special-case the blink master. |
| 20 this.builderLatestRevisions = data.latest_revisions['chromium.webkit'] ; | 37 this.builderLatestRevisions = data.latest_revisions['chromium.webkit'] ; |
| 21 this.failures = []; | 38 // FIXME: Make this a model class intead of a dumb object. |
| 39 this.failures = {}; | |
| 22 data.range_groups.forEach(function(group) { | 40 data.range_groups.forEach(function(group) { |
| 23 this._processFailuresForGroup(group, data.alerts); | 41 this._processFailuresForGroup(group, data.alerts); |
| 24 }.bind(this)); | 42 }.bind(this)); |
| 25 // FIXME: Sort this.failures by severity of regression, then by oldest FailingRevision. | 43 // FIXME: Sort this.failures by severity of regression, then by oldest FailingRevision. |
| 26 }.bind(this)); | 44 }.bind(this)); |
| 27 }, | 45 }, |
| 28 | 46 |
| 29 _failureComparator: function(a, b) { | 47 _failureComparator: function(a, b) { |
| 30 if (a.step > b.step) | 48 if (a.step > b.step) |
| 31 return 1; | 49 return 1; |
| 32 if (a.step < b.step) | 50 if (a.step < b.step) |
| 33 return -1 | 51 return -1 |
| 34 if (a.testName > b.testName) | 52 if (a.testName > b.testName) |
| 35 return 1; | 53 return 1; |
| 36 if (a.testName < b.testName) | 54 if (a.testName < b.testName) |
| 37 return -1 | 55 return -1 |
| 38 return 0; | 56 return 0; |
| 39 }, | 57 }, |
| 40 | 58 |
| 41 _processFailuresForGroup: function(group, failures) { | 59 _processFailuresForGroup: function(group, failures) { |
| 42 var failuresByReason = {}; | 60 var failuresByReason = {}; |
| 43 | 61 |
| 62 var masterToTree = {}; | |
| 63 Object.keys(this._trees, function(tree, masters) { | |
| 64 masters.forEach(function(master) { | |
| 65 masterToTree[master] = tree; | |
| 66 }); | |
| 67 }); | |
| 68 | |
| 44 group.failure_keys.forEach(function(failure_key) { | 69 group.failure_keys.forEach(function(failure_key) { |
| 45 var failure = failures.find(function(item) { return item.key == failur e_key; }); | 70 var failure = failures.find(function(item) { return item.key == failur e_key; }); |
| 46 if (failure.ignored_by.length) | 71 if (failure.ignored_by.length) |
| 47 return; | 72 return; |
| 48 | 73 |
| 49 // FIXME: Make sheriff-o-matic work for all waterfalls. | |
| 50 if (!failure.master_url.endsWith('chromium.webkit')) | |
| 51 return; | |
| 52 | |
| 53 var reason, failureType; | 74 var reason, failureType; |
| 54 if (failure.reason) { | 75 if (failure.reason) { |
| 55 // FIXME: Store the actual failure type in a different field instead of smashing it into the reason. | 76 // FIXME: Store the actual failure type in a different field instead of smashing it into the reason. |
| 56 var parts = failure.reason.split(':'); | 77 var parts = failure.reason.split(':'); |
| 57 reason = parts[0]; | 78 reason = parts[0]; |
| 58 failureType = parts[1] || 'FAIL'; | 79 failureType = parts[1] || 'FAIL'; |
| 59 } else { | 80 } else { |
| 60 reason = 'whole step failed'; | 81 reason = 'whole step failed'; |
| 61 failureType = 'UNKNOWN'; | 82 failureType = 'UNKNOWN'; |
| 62 } | 83 } |
| 63 | 84 |
| 64 var failureKey = JSON.stringify({ | 85 var failureKey = JSON.stringify({ |
| 65 step: failure.step_name, | 86 step: failure.step_name, |
| 66 reason: reason, | 87 reason: reason, |
| 67 }); | 88 }); |
| 68 | 89 |
| 90 var tree = masterToTree[failure.master_url]; | |
| 91 | |
| 69 // FIXME: Use a model class instead of a dumb object. | 92 // FIXME: Use a model class instead of a dumb object. |
| 70 if (!failuresByReason[failureKey]) | 93 if (!failuresByReason[failureKey]) |
| 71 failuresByReason[failureKey] = {}; | 94 failuresByReason[failureKey] = {}; |
| 72 // FIXME: If we have multiple builders with the same name across maste rs in | 95 if (!failuresByReason[failureKey][tree]) |
| 73 // a failure group, then this will incorrectly overwrite one of the va lues. | 96 failuresByReason[failureKey][tree] = {}; |
| 74 failuresByReason[failureKey][failure.builder_name] = { | 97 failuresByReason[failureKey][tree][failure.builder_name] = { |
| 75 // FIXME: Rename to failureType. | 98 // FIXME: Rename to failureType. |
| 76 actual: failureType, | 99 actual: failureType, |
| 77 lastFailingBuild: failure.last_failing_build, | 100 lastFailingBuild: failure.last_failing_build, |
| 78 masterUrl: failure.master_url, | 101 masterUrl: failure.master_url, |
| 79 }; | 102 }; |
| 80 }.bind(this)); | 103 }.bind(this)); |
| 81 | 104 |
| 82 var groupedFailures = []; | 105 var groupedFailures = {}; |
| 83 Object.keys(failuresByReason, function(failureKey, resultByBuilder) { | 106 Object.keys(failuresByReason, function(failureKey, resultsByTree) { |
| 84 var failure = JSON.parse(failureKey); | 107 var failure = JSON.parse(failureKey); |
| 85 groupedFailures.push(new CTFailure(failure.step, failure.reason, resul tByBuilder, group.merged_first_failing, group.merged_last_passing)); | 108 Object.keys(resultsByTree, function(tree, resultsByBuilder) { |
| 109 if (!groupedFailures[tree]) | |
| 110 groupedFailures[tree] = []; | |
| 111 groupedFailures[tree].push(new CTFailure(failure.step, failure.reaso n, resultsByBuilder, group.merged_first_failing, group.merged_last_passing)); | |
| 112 }) | |
| 86 }); | 113 }); |
| 87 | 114 |
| 88 // FIXME: Make this a model class intead of a dumb object. | 115 Object.keys(groupedFailures, function(tree, failures) { |
| 89 groupedFailures.sort(this._failureComparator); | 116 failures.sort(this._failureComparator); |
| 90 | 117 |
| 91 if (groupedFailures.length) | 118 if (!this.failures[tree]) |
| 92 this.failures.push(groupedFailures); | 119 this.failures[tree] = []; |
| 120 this.failures[tree].push(failures); | |
| 121 }.bind(this)); | |
| 93 }, | 122 }, |
| 94 }); | 123 }); |
| 95 </script> | 124 </script> |
| 96 </polymer-element> | 125 </polymer-element> |
| OLD | NEW |