Rust implementation of OCI Distribution Spec with granular access control

Embed build version in production binary #9

Open pierrelf.com
Open opened by pierrelf.com

Problem #

The health endpoint at grain.pierrelf.com/health reports "version": "test" because the BUILD_VERSION environment variable is not set during the production build. The get_build_info() function in utils.rs falls back to "test" when option_env!("BUILD_VERSION") is None.

This makes it impossible to identify which version is deployed in production.

Proposed Solution #

  • Ensure the CI/CD pipeline (spindle) sets BUILD_VERSION during cargo build
  • Consider using built or vergen crate to automatically embed git SHA and version at compile time, removing the need for manual env var management
  • Alternatively, use a build.rs script to embed git describe --tags --always output

Current behavior #

{
  "version": "test"
}

Expected behavior #

{
  "version": "0.1.0-abc1234"
}
Sign up or Sign in to add to the discussion.