Skip to content

Commit 3862043

Browse files
committed
Fix build result pages for pending jobs
We have a link on the queue page for success, pending, and failed jobs. Links to pending jobs seem to never work. This seems to be because we return HTTP status code 204, which means that no content is available. Update the result page to always attempt to show a table instead of returning a 204 when we know about the pull request, even if we have no build statuses. Update the result page to return a 404 instead of a 204 when we have no information on the pull request. This gives some information to the end user, instead of appearing to do nothing.
1 parent 5ffafdb commit 3862043

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)