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
4 found in the LICENSE file.
7 <link rel="import" href="ct-builder-list.html">
8 <link rel="import" href="ct-commit-list.html">
11 function CTStepFailureGroupData(failures, commitList) {
12 this.failures = failures;
13 this.key = failures.map(function(failure) {
16 this.commitList = commitList;
17 this.builderList = new CTBuilderList(failures);
18 this.category = 'step';
21 CTStepFailureGroupData.prototype.getAnnotations = function() {
22 return this.failures.map(function(failure) {
23 return failure.annotations();
27 CTStepFailureGroupData.prototype.failureKeys = function() {
28 return this.failures.map(function(failure) {
29 return failure.keys();
33 CTStepFailureGroupData.prototype.isTreeCloser = function() {
34 return this.failures.any(function(failure) {
35 return failure.isTreeCloser();
39 CTStepFailureGroupData.prototype.failedOnce = function() {
40 if (!this.failures.length)
43 for (var i = 0; i < this.failures.length; i++) {
44 var totalFailures = 0;
45 var resultNodes = this.failures[i].resultNodesByBuilder;
46 for (var r in resultNodes) {
47 totalFailures += resultNodes[r].failingBuildCount;
48 if (totalFailures > 1)
55 CTStepFailureGroupData.prototype.fileBugMessage = function() {
57 this.failures.forEach(function(failure) {
58 message += failure.step;
59 if (failure.testName) {
60 message += ' ' + failure.testName + '\n';
61 message += failure.flakinessDashboardURL(this.tree);
65 message += '\nRevision range:\n';
66 this.commitList.repositories.forEach(function(repository) {
67 message += repository.name + ' ' + repository.range + '\n';
69 message += '\nFailing builders:\n';
70 this.builderList.builders.forEach(function(builder) {
71 message += builder.builder + ': ' + builder.buildUrl + '\n';
77 CTStepFailureGroupData.prototype.fileBugLink = function() {
78 var fileBugUrl = 'https://code.google.com/p/chromium/issues/entry?' +
79 'status=Available&labels=Pri-2,gardening-blink&' +
80 'summary=Build%20failure&comment=Build%20is%20broken:%0a';
81 return fileBugUrl + encodeURIComponent(this.fileBugMessage());