proxMon/agent/scripts/build-linux.sh
Carsten 64dda9cb04 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>
2026-04-23 07:51:30 +02:00

24 lines
837 B
Bash
Executable file

#!/usr/bin/env bash
# Produce Linux Burrito binaries for the agent.
# Usage: ./scripts/build-linux.sh [output_dir]
set -euo pipefail
cd "$(dirname "$0")/.."
OUT="${1:-$(pwd)/dist}"
mkdir -p "$OUT"
IMG="proxmox-monitor-agent-build:latest"
# Unique per-build identifier. Git short SHA when available; otherwise a
# timestamp fallback. Passed to Docker so @version in mix.exs expands to
# `0.1.0+<BUILD_ID>` — this keys Burrito's on-host install dir so new builds
# always re-extract instead of running stale cached code.
BUILD_ID="$(git rev-parse --short=10 HEAD 2>/dev/null || echo "dev-$(date +%s)")"
echo "Build ID: $BUILD_ID"
docker build -f Dockerfile.build --build-arg BUILD_ID="$BUILD_ID" -t "$IMG" .
docker run --rm -v "$OUT":/out "$IMG" sh -c 'cp -v burrito_out/* /out/'
echo
echo "Binaries written to $OUT:"
ls -la "$OUT"