ci: take one image id when an image carries several tags [CI]
ci/woodpecker/push/web-build Pipeline was successful
ci/woodpecker/push/verify Pipeline failed
ci/woodpecker/push/dev-image Pipeline failed

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:
justme committed 2026-10-21 14:52:28 +08:00
1 parent 4f5a4aa3a9
commit 5d75fe292a
4 files changed
+29 -5

No files matched your search

+1 -3
View File
@@ -36,12 +36,10 @@ cleanup() {
trap cleanup EXIT
context="$work/context"
restore_image="localhost/moshiro-agent-restore:${CI_COMMIT_SHA}-${rid}"
restore_error="$work/restore-lookup.err"
restore_id="$(buildah images --noheading --no-trunc --format '{{.ID}}' "$restore_image" 2>"$restore_error" || true)"
restore_id="$(moshiro_image_id "$restore_image")"
[[ "${restore_id#sha256:}" =~ ^[0-9a-f]{64}$ ]] || {
echo "missing prepared restore image $restore_image; run restore-linux-dependencies.sh first" >&2
# 找不到的时候把现场打出来:查询的报错、存储配置,以及存储里现有的还原镜像,才分得清是没做出来、被清掉了,还是看的不是同一个存储
echo "lookup error: $(tr '\n' ' ' < "$restore_error")" >&2
echo "store: ${CONTAINERS_STORAGE_CONF:-unset}, uid $(id -u), isolation ${BUILDAH_ISOLATION:-unset}" >&2
{ buildah images --all --format '{{.ID}} {{.CreatedAtRaw}} {{.Name}}:{{.Tag}}' 2>&1 | grep -E 'moshiro-agent-restore|error|Error' | head -20 >&2; } || true
exit 1