Skip to content

Commit 0c36bc4

Browse files
authored
Merge pull request #31 from bryanburgers/fix-build-results
Fix build result pages for pending jobs
2 parents 5ffafdb + 3862043 commit 0c36bc4

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

homu/html/build_res.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ <h1>Homu build results - <a href="{{repo_url}}/pull/{{pull}}" target="_blank">{{
4747
<tr>
4848
<td class="hide">{{loop.index}}</td>
4949
<td>{{builder.name}}</td>
50-
<td class="{{builder.result}}"><a href="{{builder.url}}">{{builder.result}}</a></td>
50+
<td class="{{builder.result}}">
51+
{%- if builder.url -%}
52+
<a href="{{builder.url}}">{{builder.result}}</a>
53+
{%- else -%}
54+
{{ builder.result }}
55+
{%- endif -%}
56+
</td>
5157
</tr>
5258
{% endfor %}
5359
</tbody>

homu/server.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def result(repo_label, pull):
8282
states = [state for state in g.states[repo_label].values()
8383
if state.num == pull]
8484
if len(states) == 0:
85-
abort(204, 'No build results for pull request {}'.format(pull))
85+
abort(404, 'No build results for pull request {}'.format(pull))
8686

8787
state = states[0]
8888
builders = []
@@ -94,15 +94,15 @@ def result(repo_label, pull):
9494
if data['res'] is not None:
9595
result = "success" if data['res'] else "failed"
9696

97-
if not data['url']:
98-
# This happens to old try builds
99-
abort(204, 'No build results for pull request {}'.format(pull))
100-
101-
builders.append({
102-
'url': data['url'],
97+
builder_details = {
10398
'result': result,
10499
'name': builder,
105-
})
100+
}
101+
102+
if data['url']:
103+
builder_details['url'] = data['url']
104+
105+
builders.append(builder_details)
106106

107107
return g.tpls['build_res'].render(repo_label=repo_label, repo_url=repo_url,
108108
builders=builders, pull=pull)

0 commit comments

Comments
 (0)