Skip to content

Commit 33f0028

Browse files
committed
feat: make patch CI results public
Nav links CI for everyone, topic index gets a CI icon column, threads get a CI sidebar block and a beta banner with the docker image to try.
1 parent 24fea4c commit 33f0028

20 files changed

Lines changed: 1052 additions & 38 deletions

‎app/assets/stylesheets/components/ci.css‎

Lines changed: 139 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
font-weight: var(--font-weight-medium);
233233
}
234234

235-
.ci-container .muted {
235+
:is(.ci-container, .ci-badges) .muted {
236236
color: var(--color-text-muted);
237237
font-size: var(--font-size-sm);
238238
}
@@ -265,8 +265,10 @@
265265
color: var(--color-success);
266266
}
267267

268-
/* badges */
269-
.ci-container .badge {
268+
/* badges - two names, not a bare class: .b-success and friends read generic
269+
enough to collide with something else on the site, so anything outside the
270+
CI pages has to opt in by also carrying .ci-badges */
271+
:is(.ci-container, .ci-badges) .badge {
270272
display: inline-block;
271273
padding: 2px 9px;
272274
border-radius: 999px;
@@ -275,15 +277,15 @@
275277
white-space: nowrap;
276278
}
277279

278-
.ci-container .b-running { background: var(--ci-blue-bg); color: var(--ci-blue-fg); }
279-
.ci-container .b-queued { background: var(--color-bg-button); color: var(--color-text-secondary); }
280-
.ci-container .b-success { background: var(--ci-green-bg); color: var(--ci-green-fg); }
281-
.ci-container .b-testsfail { background: var(--ci-amber-bg); color: var(--ci-amber-fg); }
282-
.ci-container .b-buildfail { background: var(--ci-red-bg); color: var(--ci-red-fg); }
283-
.ci-container .b-infra { background: var(--ci-purple-bg); color: var(--ci-purple-fg); }
284-
.ci-container .b-newver { background: var(--color-primary-100); color: var(--color-primary-900); }
285-
.ci-container .b-rebase { background: var(--ci-amber-bg); color: var(--ci-amber-fg); }
286-
.ci-container .b-backfill { background: var(--color-bg-button); color: var(--color-text-secondary); }
280+
:is(.ci-container, .ci-badges) .b-running { background: var(--ci-blue-bg); color: var(--ci-blue-fg); }
281+
:is(.ci-container, .ci-badges) .b-queued { background: var(--color-bg-button); color: var(--color-text-secondary); }
282+
:is(.ci-container, .ci-badges) .b-success { background: var(--ci-green-bg); color: var(--ci-green-fg); }
283+
:is(.ci-container, .ci-badges) .b-testsfail { background: var(--ci-amber-bg); color: var(--ci-amber-fg); }
284+
:is(.ci-container, .ci-badges) .b-buildfail { background: var(--ci-red-bg); color: var(--ci-red-fg); }
285+
:is(.ci-container, .ci-badges) .b-infra { background: var(--ci-purple-bg); color: var(--ci-purple-fg); }
286+
:is(.ci-container, .ci-badges) .b-newver { background: var(--color-primary-100); color: var(--color-primary-900); }
287+
:is(.ci-container, .ci-badges) .b-rebase { background: var(--ci-amber-bg); color: var(--ci-amber-fg); }
288+
:is(.ci-container, .ci-badges) .b-backfill { background: var(--color-bg-button); color: var(--color-text-secondary); }
287289

288290
/* branch search */
289291
.ci-search {
@@ -613,3 +615,128 @@
613615
grid-template-columns: minmax(0, 1fr);
614616
}
615617
}
618+
619+
/* thread page CI block */
620+
.ci-thread-row {
621+
display: flex;
622+
gap: var(--spacing-2);
623+
align-items: baseline;
624+
margin-bottom: var(--spacing-2);
625+
}
626+
627+
.ci-thread-label {
628+
color: var(--color-text-muted);
629+
font-size: var(--font-size-xs);
630+
text-transform: uppercase;
631+
letter-spacing: 0.04em;
632+
min-width: 4.5em;
633+
}
634+
635+
.ci-thread-note {
636+
font-size: var(--font-size-sm);
637+
margin-bottom: var(--spacing-2);
638+
}
639+
640+
.ci-thread-failed {
641+
list-style: none;
642+
padding: 0;
643+
margin: 0 0 var(--spacing-2) 0;
644+
font-family: var(--font-mono);
645+
font-size: var(--font-size-xs);
646+
color: var(--ci-amber-fg);
647+
}
648+
649+
.ci-thread-links {
650+
display: flex;
651+
gap: var(--spacing-3);
652+
font-size: var(--font-size-sm);
653+
}
654+
655+
/* shared by the thread sidebar block and the banner - a wrapping row of
656+
badges/links at font-size-sm. Do not split this back into per-block copies. */
657+
.ci-thread-value,
658+
.ci-banner-status,
659+
.ci-banner-head {
660+
display: flex;
661+
flex-wrap: wrap;
662+
align-items: baseline;
663+
gap: var(--spacing-2);
664+
font-size: var(--font-size-sm);
665+
}
666+
667+
/* thread page CI banner. Tinted and accented rather than another card: it sits
668+
directly above the messages and has to read as a notice about the site, not
669+
as the first message in the thread. */
670+
.ci-banner {
671+
border: var(--border-width) solid var(--color-border);
672+
border-left: var(--border-width-reply) solid var(--color-primary-500);
673+
border-radius: var(--border-radius-md);
674+
background: var(--color-bg-hoverbox);
675+
padding: var(--spacing-3);
676+
margin-bottom: var(--spacing-4);
677+
display: flex;
678+
flex-direction: column;
679+
gap: var(--spacing-2);
680+
}
681+
682+
.ci-banner-lead {
683+
margin: 0;
684+
font-size: var(--font-size-sm);
685+
color: var(--color-text-primary);
686+
max-width: 80ch;
687+
}
688+
689+
.ci-banner-tag {
690+
display: inline-flex;
691+
align-items: baseline;
692+
gap: var(--spacing-1);
693+
padding: 2px 10px;
694+
border-radius: 999px;
695+
background: var(--ci-purple-bg);
696+
color: var(--ci-purple-fg);
697+
font-size: var(--font-size-xs);
698+
font-weight: var(--font-weight-semibold);
699+
text-transform: uppercase;
700+
letter-spacing: 0.06em;
701+
}
702+
703+
/* the commands are the one thing here worth acting on, so they get a rule of
704+
their own rather than sitting flush against the prose above them */
705+
.ci-banner-docker {
706+
border-top: var(--border-width) solid var(--color-border);
707+
padding-top: var(--spacing-2);
708+
}
709+
710+
/* one scroll container per line: .ci-copy is inline-block and nowrap, and a
711+
full ghcr ref is longer than a narrow thread column */
712+
.ci-banner-cmd-line {
713+
margin-bottom: var(--spacing-1);
714+
overflow-x: auto;
715+
}
716+
717+
.ci-banner-cmd-text {
718+
display: inline-block;
719+
font-family: var(--font-mono);
720+
font-size: var(--font-size-xs);
721+
color: var(--color-text-secondary);
722+
padding: 2px 8px;
723+
}
724+
725+
.ci-banner-docker-lead,
726+
.ci-banner-provenance {
727+
margin: 0;
728+
font-size: var(--font-size-sm);
729+
color: var(--color-text-secondary);
730+
}
731+
732+
.ci-banner-warning {
733+
display: flex;
734+
gap: var(--spacing-2);
735+
align-items: baseline;
736+
margin: 0;
737+
padding: var(--spacing-2);
738+
border-radius: var(--border-radius-sm);
739+
background: var(--ci-amber-bg);
740+
color: var(--ci-amber-fg);
741+
font-size: var(--font-size-sm);
742+
}

‎app/assets/stylesheets/components/topics.css‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
}
8888

8989
.topics-table {
90-
--topic-icon-slots: [commit] 28px [patch] 28px;
90+
--topic-icon-slots: [commit] 28px [patch] 28px [ci] 28px;
9191

9292
& table {
9393
width: 100%;
@@ -146,11 +146,11 @@
146146
}
147147

148148
.topics-table.has-personal-icons {
149-
--topic-icon-slots: [reading] 28px [star] 28px [note] 28px [commit] 28px [patch] 28px;
149+
--topic-icon-slots: [reading] 28px [star] 28px [note] 28px [commit] 28px [patch] 28px [ci] 28px;
150150
}
151151

152152
.topics-table.has-personal-icons.has-team-icons {
153-
--topic-icon-slots: [reading] 28px [star] 28px [note] 28px [team] 28px [commit] 28px [patch] 28px;
153+
--topic-icon-slots: [reading] 28px [star] 28px [note] 28px [team] 28px [commit] 28px [patch] 28px [ci] 28px;
154154
}
155155

156156
.topic-icon {
@@ -471,6 +471,14 @@ a.topic-icon {
471471
color: var(--color-success);
472472
}
473473

474+
.ci-icon-green { color: var(--ci-green-fg); }
475+
.ci-icon-amber { color: var(--ci-amber-fg); }
476+
.ci-icon-red { color: var(--ci-red-fg); }
477+
.ci-icon-purple { color: var(--ci-purple-fg); }
478+
.ci-icon-blue { color: var(--ci-blue-fg); }
479+
.ci-icon-muted { color: var(--color-text-muted); }
480+
481+
/* shared with _ci_icon.html.slim, not private to the commitfest icon */
474482
.commitfest-hover {
475483
display: flex;
476484
flex-direction: column;
@@ -1097,15 +1105,15 @@ a.topic-icon {
10971105
@media (min-width: 1400px) {
10981106
/* strip width = cell pad 8 + icons pad 8 + slots * 28 + gaps * 8 + icons pad 16 + 18 diagonal */
10991107
.topics-table {
1100-
--topic-new-replies-strip-width: 114px;
1108+
--topic-new-replies-strip-width: 150px;
11011109
}
11021110

11031111
.topics-table.has-personal-icons {
1104-
--topic-new-replies-strip-width: 222px;
1112+
--topic-new-replies-strip-width: 258px;
11051113
}
11061114

11071115
.topics-table.has-personal-icons.has-team-icons {
1108-
--topic-new-replies-strip-width: 258px;
1116+
--topic-new-replies-strip-width: 294px;
11091117
}
11101118

11111119
.topic-title-icons {
@@ -1151,6 +1159,10 @@ a.topic-icon {
11511159
.slot-patch {
11521160
grid-column: patch;
11531161
}
1162+
1163+
.slot-ci {
1164+
grid-column: ci;
1165+
}
11541166
}
11551167

11561168
@media (min-width: 1025px) and (max-width: 1399px) {

‎app/controllers/topics_controller.rb‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def index
1616
preload_topic_participants
1717
preload_commitfest_summaries
1818
preload_commit_summaries
19+
preload_ci_statuses
1920
preload_topic_mailing_lists
2021
@new_topics_count = 0
2122

@@ -66,6 +67,7 @@ def row_states
6667
preload_topic_participants
6768
preload_commitfest_summaries
6869
preload_commit_summaries
70+
preload_ci_statuses
6971
preload_topic_mailing_lists
7072
@personalization = TopicListPersonalization.new(user: current_user, topics: @topics)
7173

@@ -95,6 +97,9 @@ def show
9597
build_thread_outline(@messages)
9698
load_commitfest_sidebar
9799
load_commit_sidebar
100+
# lazy object, not a load_* call like its neighbours - the view decides
101+
# whether anything is needed, so this must not query on its own
102+
@ci_status = PatchCi::TopicStatus.new(topic: @topic)
98103

99104
@topic_mailing_lists = @topic.mailing_lists.to_a
100105
@topic_is_multi_list = @topic_mailing_lists.size > 1
@@ -408,6 +413,7 @@ def search
408413
preload_topic_participants
409414
preload_commitfest_summaries
410415
preload_commit_summaries
416+
preload_ci_statuses
411417
preload_topic_mailing_lists
412418
@personalization = TopicListPersonalization.new(user: current_user, topics: @topics) if user_signed_in?
413419
load_visible_tags if user_signed_in?
@@ -881,6 +887,12 @@ def preload_commit_summaries
881887
@commit_summaries = Topic.commit_summaries(topic_ids)
882888
end
883889

890+
def preload_ci_statuses
891+
@ci_repo_state = PatchCiRepoState.current
892+
@ci_statuses = PatchCi::CurrentPatchsets.new(repo_state: @ci_repo_state)
893+
.load(@topics.map(&:id))
894+
end
895+
884896
def load_commitfest_sidebar
885897
entries = CommitfestPatchCommitfest
886898
.joins(commitfest_patch: :commitfest_patch_topics)

0 commit comments

Comments
 (0)