ci: take one image id when an image carries several tags [CI]
Identical restore images accumulate one tag per commit, and buildah images <name> prints a row per tag, so the single-id check in build-linux-agent.sh failed for every commit after the first. moshiro_image_id returns one id and a test covers the multi-tag case.
This commit is contained in:
1 parent
4f5a4aa3a9
commit
5d75fe292a
4 files changed
+29
-5
No files matched your search
@@ -68,7 +68,7 @@ if [[ "$mode" == dev || "$mode" == agent ]]; then
|
||||
cached_key="$(cat "$builder_cache/nativeaot-builder.key" 2>/dev/null || true)"
|
||||
cached_id="$(cat "$builder_cache/nativeaot-builder.id" 2>/dev/null || true)"
|
||||
local_key="$(cat "$base_home/nativeaot-builder.key" 2>/dev/null || true)"
|
||||
local_id="$(buildah images --noheading --no-trunc --format '{{.ID}}' "$builder_image" 2>/dev/null || true)"
|
||||
local_id="$(moshiro_image_id "$builder_image")"
|
||||
if [[ "$local_key" == "$MOSHIRO_NATIVEAOT_BUILDER_KEY" && "${local_id#sha256:}" =~ ^[0-9a-f]{64}$ ]]; then
|
||||
echo "reusing the NativeAOT toolchain from the shared store"
|
||||
elif [[ "$cached_key" == "$MOSHIRO_NATIVEAOT_BUILDER_KEY" && "$cached_id" =~ ^[0-9a-f]{64}$ && -f "$builder_cache/nativeaot-builder-$cached_id.oci" ]]; then
|
||||
@@ -101,7 +101,8 @@ if [[ "$mode" == dev || "$mode" == agent ]]; then
|
||||
done
|
||||
[[ "$builder_ready" == true ]] || { echo 'could not prepare the NativeAOT toolchain' >&2; exit 1; }
|
||||
fi
|
||||
builder_image="$(buildah images --noheading --no-trunc --format '{{.ID}}' "$builder_image")"
|
||||
builder_image="$(moshiro_image_id "$builder_image")"
|
||||
[[ -n "$builder_image" ]] || { echo 'the NativeAOT toolchain image is missing after it was prepared' >&2; exit 1; }
|
||||
printf '%s\n' "$MOSHIRO_NATIVEAOT_BUILDER_KEY" > "$base_home/nativeaot-builder.key"
|
||||
builder_id="${builder_image#sha256:}"
|
||||
archive="$builder_cache/nativeaot-builder-$builder_id.oci"
|
||||
|
||||
Reference in new issue
Block a user