Skip to content

Commit 8e33e1e

Browse files
committed
Integrate previous CFbot links with new code
In previous commits (2ada851 & b6010e9) some initial links and git checkout instructions were added to the patch page. I received some in person feedback at PgConf EU that those used quite some vertical space on the page. Now that we have a dedicated row in the table for CFbot statuses, it seems natural to integrate those previous links and checkout instructions into that row. Both to keep all CFbot content together, as well as to reduce vertical space needed. To reduce the necessary space needed for the checkout instructions, these previously explicit checkout instructions have been changed to button that copies the required commands to the clipboard. Finally, this also makes "Needs rebase!" link to CFbot logs instead of CI results. I updated these logs recently on the CFbot side to become much more useful to look at, by making them actually show the conflicts.
1 parent 2796367 commit 8e33e1e

File tree

6 files changed

+41
-28
lines changed

6 files changed

+41
-28
lines changed

media/commitfest/css/commitfest.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ div.form-group div.controls input.threadpick-input {
6969
.cfbot-summary img {
7070
margin-top: -3px;
7171
}
72+
73+
.github-logo {
74+
height: 20px;
75+
}

media/commitfest/github-mark.svg

Lines changed: 1 addition & 0 deletions
Loading

media/commitfest/js/commitfest.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,10 @@ function searchUserListChanged() {
306306
$('#doSelectUserButton').addClass('disabled');
307307
}
308308
}
309+
310+
function addGitCheckoutToClipboard(patchId) {
311+
navigator.clipboard.writeText(`git remote add commitfest https://github.com/postgresql-cfbot/postgresql.git
312+
git fetch commitfest cf/${patchId}
313+
git checkout commitfest/cf/${patchId}
314+
`);
315+
}

pgcommitfest/commitfest/templates/commitfest.html

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,29 +87,28 @@ <h3>{{p.is_open|yesno:"Active patches,Closed patches"}}</h3>
8787
<td><a href="{{p.id}}/">{{p.name}}</a></td>
8888
<td><span class="label label-{{p.status|patchstatuslabel}}">{{p.status|patchstatusstring}}</span></td>
8989
<td>{%if p.targetversion%}<span class="label label-default">{{p.targetversion}}</span>{%endif%}</td>
90-
<td>
91-
{%if p.cfbot_results %}
92-
<a href="https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F{{p.id}}"
93-
class="cfbot-summary"
94-
{%if p.cfbot_results.failed_task_names %}
95-
title="Failed: {{p.cfbot_results.failed_task_names}}"
96-
{%endif%}
97-
>
98-
{%if p.cfbot_results.needs_rebase %}
90+
<td class="cfbot-summary">
91+
{%if not p.cfbot_results %}
92+
<span class="label label-default">Not processed</span>
93+
{%elif p.cfbot_results.needs_rebase %}
94+
<a href="{{p.cfbot_results.apply_url}}" title="View git apply logs">
9995
<span class="label label-warning">Needs rebase!</span>
100-
{%else%}
96+
</a>
97+
{%else%}
98+
<a href="https://github.com/postgresql-cfbot/postgresql/compare/cf/{{p.id}}~1...cf/{{p.id}}" title="View last patch set on GitHub"><img class="github-logo" src="/media/commitfest/github-mark.svg"/></a>
99+
<a href="https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F{{p.id}}"
100+
title="View CI history{%if p.cfbot_results.failed_task_names %}. Failed jobs: {{p.cfbot_results.failed_task_names}}{%endif%}">
101101
{%if p.cfbot_results.failed > 0 %}
102102
<img src="/media/commitfest/new_failure.svg"/>
103103
{%elif p.cfbot_results.completed < p.cfbot_results.total %}
104104
<img src="/media/commitfest/running.svg"/>
105105
{%else%}
106106
<img src="/media/commitfest/new_success.svg"/>
107107
{%endif%}
108+
<span class="run-counters">
108109
{{p.cfbot_results.completed}}/{{p.cfbot_results.total}}
109-
{%endif%}
110+
</span>
110111
</a>
111-
{% else %}
112-
<span class="label label-default">Not processed</span>
113112
{%endif%}
114113
</td>
115114
<td>{{p.author_names|default:''}}</td>

pgcommitfest/commitfest/templates/patch.html

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818
{%if not cfbot_branch %}
1919
<span class="label label-default">Not processed</span></a>
2020
{%elif not cfbot_branch.commit_id %}
21-
<a href="https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F{{patch.id}}">
22-
<span class="label label-warning">Needs rebase!</span></a>
21+
<a href="{{cfbot_branch.apply_url}}">
22+
<span class="label label-warning" title="View git apply logs">Needs rebase!</span></a>
23+
Additional links previous successfully applied patch (outdated):
24+
<a href="https://github.com/postgresql-cfbot/postgresql/compare/cf/{{patch.id}}~1...cf/{{patch.id}}" title="View previous successfully applied patch set on GitHub"><img class="github-logo" src="/media/commitfest/github-mark.svg"/></a>
25+
<a href="https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F{{patch.id}}">
26+
<span class="label label-default">Summary</span></a>
2327
{%else%}
28+
<a href="https://github.com/postgresql-cfbot/postgresql/compare/cf/{{patch.id}}~1...cf/{{patch.id}}" title="View last patch set on GitHub"><img class="github-logo" src="/media/commitfest/github-mark.svg"/></a>
2429
<a href="https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F{{patch.id}}">
2530
<span class="label label-default">Summary</span></a>
2631
{%for c in cfbot_tasks %}
@@ -34,6 +39,12 @@
3439
<a href="https://cirrusci.com/task/{{c.id}}" title="{{c.task_name}}: {{c.status}}"><img src="/media/commitfest/new_failure.svg"/></a>
3540
{%endif%}
3641
{%endfor%}
42+
{%endif%}
43+
{%if cfbot_branch %}
44+
<button class="btn btn-default" title="This adds the following to your clipboard (needs to be run in an existing git repo):
45+
git remote add commitfest https://github.com/postgresql-cfbot/postgresql.git
46+
git fetch commitfest cf/{{patch.id}}
47+
git checkout commitfest/cf/{{patch.id}}" onclick="addGitCheckoutToClipboard({{patch.id}})">Copy git checkout commands</button>
3748
{%endif%}
3849
</a>
3950
</td>
@@ -81,21 +92,11 @@
8192
</tr>
8293
<tr>
8394
<th>Links</th>
84-
<td style="white-space:pre-line"><a href="https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F{{patch.id}}">CFbot results (CirrusCI)</a>
85-
<a href="https://github.com/postgresql-cfbot/postgresql/compare/cf/{{patch.id}}~1...cf/{{patch.id}}">CFbot GitHub</a>{%if patch.wikilink%}
95+
{%if patch.wikilink%}
8696
<a href="{{patch.wikilink}}">Wiki</a>{%endif%}{%if patch.gitlink%}
8797
<a href="{{patch.gitlink}}">Git</a>
8898
{%endif%}</td>
8999
</tr>
90-
<tr>
91-
<th>Checkout latest CFbot patchset</th>
92-
<td>
93-
Go to your local checkout of the PostgreSQL repository and run:
94-
<pre><code>git remote add commitfest https://github.com/postgresql-cfbot/postgresql.git
95-
git fetch commitfest cf/{{patch.id}}
96-
git checkout commitfest/cf/{{patch.id}}</code></pre>
97-
</td>
98-
</tr>
99100
<tr>
100101
<th>Emails</th>
101102
<td>

pgcommitfest/commitfest/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,12 @@ def commitfest(request, cfid):
224224
count(*) FILTER (WHERE task.status in ('ABORTED', 'ERRORED', 'FAILED')) failed,
225225
count(*) total,
226226
string_agg(task.task_name, ', ') FILTER (WHERE task.status in ('ABORTED', 'ERRORED', 'FAILED')) as failed_task_names,
227-
branch.commit_id IS NULL as needs_rebase
227+
branch.commit_id IS NULL as needs_rebase,
228+
branch.apply_url
228229
FROM commitfest_cfbotbranch branch
229230
LEFT JOIN commitfest_cfbottask task ON task.branch_id = branch.branch_id
230231
WHERE branch.patch_id=p.id
231-
GROUP BY branch.commit_id
232+
GROUP BY branch.patch_id
232233
) t
233234
)
234235
FROM commitfest_patch p

0 commit comments

Comments
 (0)