mirror of
https://seed.radicle.dev/rad:zwTxygwuz5LDGBq255RA2CbNGrz8.git
synced 2026-11-21 02:40:42 +08:00
feat: produce RSS feed of unfinished CI runs
That's CI runs that have been triggered, are running, but have not finished. Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
@@ -40,6 +40,7 @@ use crate::{
|
||||
|
||||
const BROKER_RSS: &str = "index.rss";
|
||||
const FAILURE_RSS: &str = "failed.rss";
|
||||
const UNFINISHED_RSS: &str = "unfinished.rss";
|
||||
const CSS: &str = include_str!("radicle-ci.css");
|
||||
const REFERESH_INTERVAL: &str = "300";
|
||||
const UPDATE_INTERVAL: Duration = Duration::from_secs(60);
|
||||
@@ -627,6 +628,22 @@ impl PageData {
|
||||
Ok(channel.build())
|
||||
}
|
||||
|
||||
fn unfinished_as_rss(&self) -> Result<Channel, PageError> {
|
||||
let mut channel = ChannelBuilder::default();
|
||||
channel
|
||||
.title("Radicle CI broker run information")
|
||||
.description("All CI runs known to this instance of the Radicle CI broker.")
|
||||
.link("FIXME:link");
|
||||
for (_alias, repo_id) in self.repos() {
|
||||
for run in self.runs(repo_id) {
|
||||
if run.state() == RunState::Triggered || run.state() == RunState::Running {
|
||||
channel.item(Self::rss_item_from_run(run)?);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(channel.build())
|
||||
}
|
||||
|
||||
fn rss_item_from_run(run: &Run) -> Result<Item, PageError> {
|
||||
let mut guid = Guid::default();
|
||||
guid.set_value(run.broker_run_id().to_string());
|
||||
@@ -857,6 +874,11 @@ impl StatusPage {
|
||||
let channel = data.failed_as_rss()?;
|
||||
let rss = channel.to_string();
|
||||
Self::write_file(&filename, &rss)?;
|
||||
|
||||
let filename = dirname.join(UNFINISHED_RSS);
|
||||
let channel = data.unfinished_as_rss()?;
|
||||
let rss = channel.to_string();
|
||||
Self::write_file(&filename, &rss)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user