diff --git a/ci-broker.md b/ci-broker.md index fbd49315..e49afe81 100644 --- a/ci-broker.md +++ b/ci-broker.md @@ -2176,6 +2176,7 @@ then file reports/status.json exists when I run jq .event_queue_length reports/status.json then stdout is exactly "0\n" ~~~ + # Acceptance criteria for upgrades _What:_ The node operator can safely upgrade the CI broker. At the diff --git a/src/pages.rs b/src/pages.rs index 2a4b635a..6e229276 100644 --- a/src/pages.rs +++ b/src/pages.rs @@ -646,10 +646,22 @@ impl PageData { parse_timestamp(&ts).map_err(|err| PageError::RssTimestamp(ts.clone(), err))?; let ts = rfc822_timestamp(parsed).map_err(|err| PageError::RssTimestamp(ts, err))?; + let entry = RssEntry { + repoid: run.repo_id(), + commit: match run.whence() { + Whence::Branch { commit, .. } => *commit, + Whence::Patch { commit, .. } => *commit, + }, + info_url: run.adapter_info_url().map(String::from), + status: run.state(), + result: run.result().cloned(), + }; + let mut item = ItemBuilder::default() .title(Some(title)) .guid(Some(guid)) .pub_date(Some(ts)) + .content(entry.to_html().serialize()) .build(); if let Some(url) = run.adapter_info_url() { @@ -660,6 +672,48 @@ impl PageData { } } +struct RssEntry { + repoid: RepoId, + commit: Oid, + info_url: Option, + status: RunState, + result: Option, +} + +impl RssEntry { + fn to_html(&self) -> Element { + Element::new(Tag::Div) + .with_class("ci_run") + .with_child( + Element::new(Tag::Span) + .with_class("repoid") + .with_text(&self.repoid.to_string()), + ) + .with_child( + Element::new(Tag::Span) + .with_class("commit") + .with_text(&self.commit.to_string()), + ) + .with_child( + Element::new(Tag::Span) + .with_class("info_url") + .with_text(self.info_url.as_deref().unwrap_or("")), + ) + .with_child( + Element::new(Tag::Span) + .with_class("status") + .with_text(&self.status.to_string()), + ) + .with_child(Element::new(Tag::Span).with_class("result").with_text( + match &self.result { + None => "undetermined", + Some(RunResult::Success) => "success", + Some(RunResult::Failure) => "failure", + }, + )) + } +} + /// Data for status pages for CI broker. /// /// There is a "front page" with status about the broker, and a list