Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Merge 2477f96 into 163ea86
Browse files Browse the repository at this point in the history
  • Loading branch information
warcholprzemo committed May 16, 2018
2 parents 163ea86 + 2477f96 commit 028acc3
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 44 deletions.
2 changes: 1 addition & 1 deletion master/buildbot/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1525251296
1526451617
2 changes: 2 additions & 0 deletions master/buildbot/status/buildstep.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from twisted.internet import reactor, defer
from buildbot import interfaces, util
from buildbot.status.logfile import LogFile, HTMLLogFile
from buildbot.status.results import SKIPPED

class BuildStepStatus(styles.Versioned):
"""
Expand Down Expand Up @@ -428,6 +429,7 @@ def asDict(self, request=None):
result['eta'] = self.getETA()
result['step_number'] = self.step_number
result['hidden'] = self.hidden
result['is_skipped'] = result['results'][0] == SKIPPED

args = getCodebasesArg(request)
result['logs'] = [[l.getName(),
Expand Down
17 changes: 14 additions & 3 deletions master/buildbot/status/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,20 @@
#
# Copyright Buildbot Team Members

BEGINNING, SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION, \
RETRY, CANCELED, NOT_REBUILT, DEPENDENCY_FAILURE, RESUME, \
MERGED, INTERRUPTED = range(-1, 12)
BEGINNING = -1
SUCCESS = 0
WARNINGS = 1
FAILURE = 2
SKIPPED = 3
EXCEPTION = 4
RETRY = 5
CANCELED = 6
NOT_REBUILT = 7
DEPENDENCY_FAILURE = 8
RESUME = 9
MERGED = 10
INTERRUPTED = 11


Results = ["success", "warnings", "failure", "skipped", "exception", "retry", "canceled", "not-rebuilt",
"dependency-failure", "resume", "merged", "interrupted"]
Expand Down
22 changes: 11 additions & 11 deletions www/prod/script/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion www/prod/script/main.js.map

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions www/script/project/rtBuildDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ define(function (require) {
$progressBar.addClass("build-detail-progress");
helpers.delegateToProgressBar($progressBar);
},
/* Setup `hasDependency` and `hasArtifacts` flags based on `url` and `is_not_skipped`
values from backend
@return stepData with above flags.
*/
setup_dependencies_and_artifacts_flags: function(stepData){
$.each(stepData.urls, function (j, url) {
stepData.hasDependency = false;
stepData.hasArtifacts = true;
if (url.url !== undefined) {
stepData.hasArtifacts = false;
if(stepData.is_skipped === false){
stepData.hasDependency = true;
}
}
return true;
});
return stepData;
},
processSteps: function (data) {
var html = "";
var $stepList = $('#stepList');
Expand All @@ -157,14 +175,7 @@ define(function (require) {
status = helpers.cssClassesEnum.RUNNING;
}

stepData.hasURLs = Object.keys(stepData.urls).length > 0;
$.each(stepData.urls, function (i, url) {
if (url.url !== undefined) {
stepData.hasDependency = true;
return false;
}
return true;
});
stepData = rtBuildDetail.setup_dependencies_and_artifacts_flags(stepData);

var cssClass = helpers.getCssClassFromStatus(status);
var startTime = stepData.times[0];
Expand Down
40 changes: 21 additions & 19 deletions www/script/templates/build.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,32 @@
</div>
{{/if}}

{{#if s.hasURLs}}
<div class="logs-txt">
{{#if s.hasDependency}}
<div class="logs-txt">
{{#if s.hasDependency}}
Dependencies
{{else}}
{{/if}}
{{#if s.hasArtifacts}}
Artifacts
{{/if}}
</div>
<ul class="log-list log-list-js dependency-list">
{{#eachByStatus s.urls 'results'}}
{{#if this.results includeZero=true}}
<li class="log-list-{{buildCSSClass this.results }} urls-mod clearfix">
{{/if}}
</div>
<ul class="log-list log-list-js dependency-list">
{{#if s.hasDependency}}
{{#eachByStatus s.urls 'results'}}
<li class="log-list-{{buildCSSClass this.results }} urls-mod clearfix">
<a title="{{ @index }}" href="{{ this.url }}">
<span class="{{buildCSSClass this.results }}"></span>{{ @index }}
</a>
</li>
{{else}}
<li class="artifact-js">
<a target="_blank" href="{{ this }}">{{ @index }}</a>
</li>
{{/if}}
{{/eachByStatus}}
</ul>
{{/if}}
</li>
{{/eachByStatus}}
{{/if}}
{{#if s.hasArtifacts}}
{{#eachByStatus s.urls 'results'}}
<li class="artifact-js">
<a target="_blank" href="{{ this }}">{{ @index }}</a>
</li>
{{/eachByStatus}}
{{/if}}
</ul>
</li>
{{/stepStarted}}

Expand Down
62 changes: 61 additions & 1 deletion www/script/test/test_rtBuildDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ define(function (require) {
expect(htmlLink.length).toEqual(1);
});

it("if logs list contains the same keys result will render the last one", function () {
it("if logs list contains the same keys result will render the last one", function () {
var data = {
steps : [],
logs :[["TestResults.xml", "the/first/link/TestResults.xml"],
Expand All @@ -77,5 +77,65 @@ define(function (require) {
expect(xmlLink.length).toEqual(1);
expect(htmlLink.length).toEqual(1);
});

it("checks if NOT skipped step correctly setup hasDependency and hasArtifacts flag", function(){
var stepData = {
'urls': {'Child #3': {'url': 'http:/127.0.0.1:/projects/DeveloperTests/builders/Child/builds/3'}},
'is_skipped': false
}

stepData = rtBuildDetails.setup_dependencies_and_artifacts_flags(stepData);

expect(stepData.hasDependency).toEqual(true);
expect(stepData.hasArtifacts).toEqual(false);
});

it("checks if skipped step correctly setup hasDependency and hasArtifacts flag", function(){
var stepData = {
'urls': {'Child #3': {'url': 'http:/127.0.0.1:/projects/DeveloperTests/builders/Child/builds/3'}},
'is_skipped': true
}

stepData = rtBuildDetails.setup_dependencies_and_artifacts_flags(stepData);

expect(stepData.hasDependency).toEqual(false);
expect(stepData.hasArtifacts).toEqual(false);
});

it("checks if step with artifacts correctly setup hasDependency and hasArtifacts flag", function(){
var stepData = {
'urls': {'Test.txt': 'http://artifacts/SomeTest/Test.txt'},
'is_skipped': false
}

stepData = rtBuildDetails.setup_dependencies_and_artifacts_flags(stepData);

expect(stepData.hasDependency).toEqual(false);
expect(stepData.hasArtifacts).toEqual(true);
});

it("checks if step with artifacts (skipped) correctly setup hasDependency and hasArtifacts flag", function(){
var stepData = {
'urls': {'Test.txt': 'http://artifacts/SomeTest/Test.txt'},
'is_skipped': true
}

stepData = rtBuildDetails.setup_dependencies_and_artifacts_flags(stepData);

expect(stepData.hasDependency).toEqual(false);
expect(stepData.hasArtifacts).toEqual(true);
});

it("checks if step with with empty urls do not setup hasDependency and hasArtifacts flag", function(){
var stepData = {
'urls': {},
'is_skipped': false
}

stepData = rtBuildDetails.setup_dependencies_and_artifacts_flags(stepData);

expect(stepData.hasDependency).toEqual(undefined);
expect(stepData.hasArtifacts).toEqual(undefined);
});
});
});

0 comments on commit 028acc3

Please sign in to comment.