From 2bc05da433e39a159dcf78171f70bb6d1f90326d Mon Sep 17 00:00:00 2001 From: John Coffey Date: Sun, 15 Nov 2026 14:10:02 -0700 Subject: [PATCH] The image's binaries are executable when built from a download A release's binaries download as 0644 and the image keeps the mode it's given, so v0.1.0's first image couldn't start (exec: permission denied). build-image.sh now makes them executable in its build context, the GitHub workflow does too after checking them, and the workflow then runs both binaries from the pushed image and checks their version. --- .github/workflows/release.yml | 8 ++++++++ scripts/build-image.sh | 3 +++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b362466..c709b4b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,6 +79,8 @@ jobs: (cd dist && sha256sum --strict -c SHA256SUMS) [ "$(ls dist | wc -l)" = "$(( $(wc -l < dist/SHA256SUMS) + 2 ))" ] \ || { echo "dist has files SHA256SUMS doesn't list" >&2; ls dist >&2; exit 1; } + # Downloads aren't executable; the image copies the binaries as they are. + chmod 0755 dist/obs-beacond-linux-* dist/obs-beacon-agent-linux-* - name: GitHub Release run: | set -euo pipefail @@ -105,3 +107,9 @@ jobs: fi docker buildx imagetools inspect "$image:$version" docker logout ghcr.io + # The image as anyone gets it: both binaries run and say this version. + for bin in obs-beacond obs-beacon-agent; do + got="$(docker run --rm --pull always --entrypoint "/usr/bin/$bin" "$image:$version" -version)" + echo "$bin: $got" + grep -qF "$version" <<<"$got" || { echo "$image:$version's $bin says $got" >&2; exit 1; } + done diff --git a/scripts/build-image.sh b/scripts/build-image.sh index 2290df6..eee19a5 100755 --- a/scripts/build-image.sh +++ b/scripts/build-image.sh @@ -24,6 +24,9 @@ done # A small build context: only what the image holds. ctx="$(mktemp -d)"; trap 'rm -rf "$ctx"' EXIT cp LICENSE THIRD_PARTY_NOTICES.md "$DIST"/obs-beacond-linux-{amd64,arm64} "$DIST"/obs-beacon-agent-linux-{amd64,arm64} "$ctx/" +# Binaries downloaded from a release aren't executable, and the image keeps +# the mode it's given. +chmod 0755 "$ctx"/obs-beacond-linux-* "$ctx"/obs-beacon-agent-linux-* args=(--file deploy/container/Containerfile --platform linux/amd64,linux/arm64 --build-arg "VERSION=$VERSION" --provenance=false) if [ -n "$IMAGE" ]; then -- 2.54.0