You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to add a suffix to the version reported by zinnia and zinniad when these binaries were not built by our release CI workflow.
For example, 0.11.0 is reported by the released binary (no change) and 0.11.0.1-dev is reported by everything else - binaries built by our CI workflow for pull requests, binaries built locally using cargo build, and so on.
Places we need to change:
zinnia --version
zinniad --version
Zinnia.versions.zinnia API - this must match the value reported by --version
How to build the version string:
fnzinnia_version() -> &'static str{let pkg_version = env!("CARGO_PKG_VERSION");let is_release_build = option_env!("GITHUB_REF_TYPE") == Some("tag")
&& option_env!("GITHUB_REF_NAME") == Some(pkg_version);if is_release_build {
pkg_version
}else{// We cannot use pkg_version here// error: expected a literal// note: only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()`concat!(env!("CARGO_PKG_VERSION"), ".1-dev")}}
Now the trick is that we need to make this change in such way that other components reading CARGO_PKG_VERSION pick up the change too. The clap argument parser in particular.
//! build.rsfnmain(){// If we set CARGO_PKG_VERSION this way, then it will override the default value, which is// taken from the `version` in Cargo.toml.ifletOk(val) = std::env::var("FLOWCTL_RELEASE_VERSION"){println!("cargo:rustc-env=CARGO_PKG_VERSION={}", val);}println!("cargo:rerun-if-env-changed=FLOWCTL_RELEASE_VERSION");}
The text was updated successfully, but these errors were encountered:
It would be nice to add a suffix to the version reported by
zinnia
andzinniad
when these binaries were not built by our release CI workflow.For example,
0.11.0
is reported by the released binary (no change) and0.11.0.1-dev
is reported by everything else - binaries built by our CI workflow for pull requests, binaries built locally usingcargo build
, and so on.Places we need to change:
zinnia --version
zinniad --version
Zinnia.versions.zinnia
API - this must match the value reported by--version
How to build the version string:
Now the trick is that we need to make this change in such way that other components reading
CARGO_PKG_VERSION
pick up the change too. Theclap
argument parser in particular.A possible solution is to add a build script to tweak the version. Quoting from rust-lang/cargo#6583 (comment):
The text was updated successfully, but these errors were encountered: