Skip to content

[Packaging] Overwrite Firecracker version string at compile time #3057

@folliehiyuki

Description

@folliehiyuki

Describe the bug

FIRECRACKER_VERSION env is set at compile time by the build script build.rs (with git describe --dirty command and fallbacks to CARGO_PKG_VERSION).

This is troublesome for 3rd-party packaging systems (eg. Linux distros) as lots of them store build scripts and build applications from their release tarballs inside a git repo.

To Reproduce

  • Be inside a git repo with a tag
  • Download and extract the latest tarball of Firecracker
  • Build firecracker
  • Run firecracker --version

Expected behaviour

A way to overwrite the version string at build time instead of relying on build.rs. Ideally something like this:

FIRECRACKER_VERSION=v10.0.0 cargo build --release

would produce the version string v10.0.0.

Additional context

Here is the output from firecracker package on AlpineLinux testing repo:

$ firecracker --version
Firecracker v3.16.0-2407-g5586fce819

Supported snapshot data format versions: v0.23.0, v0.24.0, v0.25.0, v1.0.0, v1.1.0

ArchLinux is using a hacky way (pulling the git repo at specific commit instead of downloading the release tarball) to bypass the build script.

I'd suggest setting the env FIRECRACKER_VERSION only inside devtool script and remove build.rs.

Checks

  • Have you searched the Firecracker Issues database for similar problems?
  • Have you read the existing relevant Firecracker documentation?
  • Are you certain the bug being reported is a Firecracker issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueIndicates a good issue for first-time contributorsType: BugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions