Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
feat: version number now includes Git commit short id
Archived liw opened 1 year ago

Signed-off-by: Lars Wirzenius liw@liw.fi

6 files changed +10 -6 bcbd2ffc b462cea3
modified build.rs
@@ -21,6 +21,10 @@ fn main() {
        .unwrap_or_else(|| String::from("unknown"));

    println!("cargo:rustc-env=GIT_HEAD={hash}");
+
    println!(
+
        "cargo:rustc-env=VERSION={}@{hash}",
+
        env!("CARGO_PKG_VERSION")
+
    );
    println!("cargo:rustc-rerun-if-changed=.git/HEAD");

    if let Err(e) = subplot_build::codegen("ci-broker.subplot") {
modified ci-broker.md
@@ -516,10 +516,10 @@ _Who:_ `cib-devs`
given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh

when I run cib --version
-
then stdout matches regex ^radicle-ci-broker \d+\.\d+\.\d+$
+
then stdout matches regex ^radicle-ci-broker \d+\.\d+\.\d+@

when I run cibtool --version
-
then stdout matches regex ^radicle-ci-broker \d+\.\d+\.\d+$
+
then stdout matches regex ^radicle-ci-broker \d+\.\d+\.\d+@
~~~


modified src/bin/cib.rs
@@ -55,7 +55,7 @@ fn fallible_main() -> Result<(), CibError> {
/// CI for the events that get past the filter. The filter, and the
/// way CI is run, is defined in the configuration file.
#[derive(Debug, Parser)]
-
#[command(version)]
+
#[command(version = env!("VERSION"))]
struct Args {
    /// Load configuration from this YAML file. (There is no default
    /// location.)
modified src/bin/cibtool.rs
@@ -83,7 +83,7 @@ trait Leaf {
}

#[derive(Parser)]
-
#[command(version)]
+
#[command(version = env!("VERSION"))]
struct Args {
    /// Name of the SQLite database file. The file will be created if
    /// it does not already exist. Locking is handled automatically.
modified src/logger.rs
@@ -298,7 +298,7 @@ pub fn start_cib() {
    info!(
        msg_id = ?Id::CibStart,
        kind = %Kind::Startup,
-
        version = env!("GIT_HEAD"),
+
        version = env!("VERSION"),
        "CI broker starts"
    );
}
modified src/pages.rs
@@ -839,7 +839,7 @@ impl StatusPage {

            let data = PageData {
                timestamp: now()?,
-
                ci_broker_version: env!("CARGO_PKG_VERSION"),
+
                ci_broker_version: env!("VERSION"),
                ci_broker_git_commit: env!("GIT_HEAD"),
                node_alias: self.node_alias.clone(),
                runs: HashMap::from_iter(