OXYGENHUB

Build identity in flow --version and runner reports 2d025bbf9842

flow --version, and the version a runner reports to the hub, name what
was built: OXY_BUILD (make build sets it from oxy describe), the heads of
a Flow build, or "local build". flow_core::VERSION says the library's
version for hosts built on it.

closes #13
Author
Andy McCall @andymccall <[email protected]>
When
· 2026-09-29 17:42 UTC
Signature
✔ signed by Andy McCall
Hash
2d025bbf98423dd14c0d740d93c592f3c74ea359debb49b52dc1ba880e041311
Depends on
e0918b887850 f98a8f7881e0 fc10d9e80383
Depended on by
060d459ff6c6 de1d7926185f 3007d8f011fa
In bookmarks
main newer-pipeline push-uses-login
In tags
v0.2.0 v0.3.0 v0.3.1 v0.4.0 v0.5.0 v0.5.1 v0.5.2 v0.5.3
Edits
9 atoms, 1 tree operation, 5 files

Browse the tree at this change

added crates/flow/build.rs +20 −0
1 +
//! The build's identity, for the version it reports: `OXY_BUILD` when a release or
2 +
//! an install sets it (from `oxy describe`), else the heads a Flow job is
3 +
//! building, else "local build".
4 +
fn main() {
5 +
    println!("cargo:rerun-if-env-changed=OXY_BUILD");
6 +
    println!("cargo:rerun-if-env-changed=FLOW_HEADS");
7 +
    let build = std::env::var("OXY_BUILD")
8 +
        .ok()
9 +
        .map(|b| b.trim().to_string())
10 +
        .filter(|b| !b.is_empty())
11 +
        .or_else(|| {
12 +
            std::env::var("FLOW_HEADS")
13 +
                .ok()
14 +
                .and_then(|h| h.split('+').next().map(|x| format!("flow #{}", &x[..12.min(x.len())])))
15 +
                .filter(|b| b.len() > "flow #".len())
16 +
        })
17 +
        .unwrap_or_else(|| "local build".into());
18 +
    println!("cargo:rustc-env=OXY_BUILD_ID={build}");
19 +
    println!("cargo:rustc-env=OXY_VERSION_LONG={} ({build})", std::env::var("CARGO_PKG_VERSION").unwrap());
20 +
}
modified Makefile +1 −1
…
10 unchanged lines
11 11
.PHONY: build deploy-runner
12 12
13 13
build:
14 -
	cargo build --release -p flow
14 +
	OXY_BUILD="$$(oxy --plain describe 2>/dev/null)" cargo build --release -p flow
15 15
	RUSTFLAGS="-C target-feature=+crt-static" cargo build --release -p flow-init --target x86_64-unknown-linux-gnu
16 16
17 17
deploy-runner: build
…
14 unchanged lines
modified crates/flow-core/src/lib.rs +3 −0
1 1
//! OxygenFlow core (docs/spec.md, docs/m0.md): pipelines, their
2 2
//! canonical form and hashes, and execution receipts. No I/O.
3 3
4 +
/// This library's version, for hosts that report what they are built on.
5 +
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
6 +
4 7
pub mod api;
5 8
pub mod canonical;
6 9
pub mod pipeline;
…
8 unchanged lines
modified crates/flow/src/main.rs +1 −1
…
17 unchanged lines
18 18
use std::time::Duration;
19 19
20 20
#[derive(Parser)]
21 -
#[command(name = "flow", version, about = "OxygenFlow: hermetic pipelines for Oxygen repositories")]
21 +
#[command(name = "flow", version = env!("OXY_VERSION_LONG"), about = "OxygenFlow: hermetic pipelines for Oxygen repositories")]
22 22
struct Cli {
23 23
    /// The Flow home (default $FLOW_HOME, else ~/.local/share/flow).
24 24
    #[arg(long, global = true)]
…
298 unchanged lines
modified crates/flow/src/runner.rs +5 −2
…
84 unchanged lines
85 85
        token: token.trim().to_string(),
86 86
        name: name.to_string(),
87 87
        identity: hex::encode(key.identity.encode()),
88 -
        info: RunnerInfo::here(labels.clone(), 1, None, None),
88 +
        info: RunnerInfo { version: env!("OXY_VERSION_LONG").into(), ..RunnerInfo::here(labels.clone(), 1, None, None) },
89 89
    };
90 90
    let url = format!("{hub}/api/v1/flow/runners/register");
91 91
    let got: Registered = match agent.post(&url).send_json(&req) {
…
93 unchanged lines
185 185
            runtimes: vec!["microvm".into()],
186 186
            free_memory_mib,
187 187
            free_cpus,
188 -
            info: Some(RunnerInfo::here(cfg.labels.clone(), budget.max_jobs as u32, cfg.memory_mib, cfg.cpus)),
188 +
            info: Some(RunnerInfo {
189 +
                version: env!("OXY_VERSION_LONG").into(),
190 +
                ..RunnerInfo::here(cfg.labels.clone(), budget.max_jobs as u32, cfg.memory_mib, cfg.cpus)
191 +
            }),
189 192
        };
190 193
        match hub.claim(&req) {
191 194
            Ok(Some(claim)) => {
…
335 unchanged lines