fix(agent): derive @version from BUILD_ID so Burrito re-extracts per build

Burrito keys its on-host install directory on `{release}_erts-{ertsver}_{appver}`
and skips extraction when `_metadata.json` is already present for that version.
With a static `@version "0.1.0"` in mix.exs, every new build landed in the same
cached dir on the target host — silently running stale code.

Now @version resolves to `0.1.0+<BUILD_ID>` where BUILD_ID is the git short SHA
(or `dev-<timestamp>` fallback). scripts/build-linux.sh computes it on the host
and passes it through Dockerfile.build's ARG/ENV, so every commit produces a
distinct Burrito install dir and fresh extraction is guaranteed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Carsten 2026-04-23 07:51:30 +02:00
parent 3367b95b91
commit 64dda9cb04
3 changed files with 24 additions and 3 deletions

View file

@ -1,12 +1,12 @@
defmodule ProxmoxAgent.MixProject do
use Mix.Project
@version "0.1.0"
@version_base "0.1.0"
def project do
[
app: :agent,
version: @version,
version: version(),
elixir: "~> 1.17",
start_permanent: Mix.env() == :prod,
deps: deps(),
@ -22,6 +22,15 @@ defmodule ProxmoxAgent.MixProject do
]
end
# Version is built per-invocation so every commit produces a distinct Burrito
# install directory on the target host (`<release>_erts-<ertsver>_<version>`).
# Without this, Burrito sees an existing `_metadata.json` for the same version
# and skips extraction, silently running stale cached code.
defp version do
build_id = System.get_env("BUILD_ID") || "dev"
"#{@version_base}+#{build_id}"
end
defp deps do
[
{:slipstream, "~> 1.1"},