Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
feat: add "cibtool cob" to add runs to a job COB
Lars Wirzenius committed 4 months ago
commit 21db3db163531ff0f652224d018a961822110b59
parent c60c427
5 files changed +45 -1
modified .gitignore
@@ -2,4 +2,5 @@
*.html
/result
/target
-
doc/messages.md

\ No newline at end of file
+
doc/messages.md
+
perf.*
modified Cargo.toml
@@ -43,3 +43,6 @@ features = ["default", "test"]
culpa = "1.0.2"
qcheck = { version = "1", default-features = false }
qcheck-macros = { version = "1", default-features = false }
+

+
[profile.release]
+
debug = true
modified src/bin/cibtool.rs
@@ -117,6 +117,8 @@ enum Cmd {
    #[clap(hide = true)]
    Message(cibtoolcmd::MessageCmd),
    Log(cibtoolcmd::LogCmd),
+
    #[clap(hide = true)]
+
    Cob(cibtoolcmd::CobCmd),
}

impl Subcommand for Cmd {
@@ -130,6 +132,7 @@ impl Subcommand for Cmd {
            Self::Timeout(x) => x.run(args),
            Self::Message(x) => x.run(args),
            Self::Log(x) => x.run(args),
+
            Self::Cob(x) => x.run(args),
        }
    }
}
@@ -366,4 +369,7 @@ enum CibToolError {

    #[error(transparent)]
    Run(#[from] cibtoolcmd::RunError),
+

+
    #[error(transparent)]
+
    Cob(#[from] radicle_ci_broker::cob::JobError),
}
added src/bin/cibtoolcmd/cob.rs
@@ -0,0 +1,31 @@
+
use url::Url;
+

+
use radicle::{git::Oid, identity::RepoId};
+

+
use radicle_ci_broker::cob::*;
+

+
use super::*;
+

+
#[derive(Parser)]
+
pub struct CobCmd {
+
    /// ID of repository.
+
    repo_id: RepoId,
+

+
    /// Git object ID.
+
    oid: Oid,
+

+
    /// Create this many runs in job COB.
+
    n: usize,
+
}
+

+
impl Leaf for CobCmd {
+
    fn run(&self, _args: &Args) -> Result<(), CibToolError> {
+
        let url = Url::parse("https://liw.fi").unwrap();
+
        let run_id = RunId::default();
+
        for i in 0..self.n {
+
            println!("{i}");
+
            create_run(self.repo_id, self.oid, run_id.clone(), &url);
+
        }
+
        Ok(())
+
    }
+
}
modified src/bin/cibtoolcmd/mod.rs
@@ -29,3 +29,6 @@ pub use message::*;

mod log;
pub use log::*;
+

+
mod cob;
+
pub use cob::*;