Skip to content

Commit 9907636

Browse files
committed
ci(framework-build-base): read only the registry's not-found as unpublished
A failed tag read (registry, token or network) used to read as unpublished, so the job rebuilt and moved the sha tag past the replace guard and before the backfill. Now only buildx's not-found answer means unpublished; any other failure stops the job naming the ref and the error. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSrcejjpWHd8D1fpmZ
1 parent dd539bd commit 9907636

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎.github/workflows/framework-build-base.yml‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,26 @@ jobs:
210210
REPLACE: ${{ inputs.replace_published && 'true' || 'false' }}
211211
run: |
212212
set -euo pipefail
213-
DIGEST="$(docker buildx imagetools inspect "$REF" --format '{{json .Manifest}}' 2>/dev/null | jq -r '.digest // empty' || true)"
213+
# Only the registry's own "no such tag" answer means unpublished. Any
214+
# other failed read (a registry, token or network error) stops the job:
215+
# read as unpublished it would rebuild and move the tag past both
216+
# guards below. buildx prints that answer as `ERROR: REF: not found`:
217+
# containerd's resolver (core/remotes/docker/resolver.go) wraps a 404
218+
# for the tag as "REF: " plus errdefs.ErrNotFound, whose text is
219+
# "not found", and buildx's main.go prefixes "ERROR: ".
220+
ERR="$(mktemp)"
221+
if READ="$(docker buildx imagetools inspect "$REF" --format '{{json .Manifest}}' 2>"$ERR")"; then
222+
DIGEST="$(printf '%s' "$READ" | jq -r '.digest // empty')"
223+
if [ -z "$DIGEST" ]; then
224+
echo "::error::$REF was read, but the answer names no digest: $READ"
225+
exit 1
226+
fi
227+
elif grep -Fq "$REF: not found" "$ERR"; then
228+
DIGEST=""
229+
else
230+
echo "::error::cannot tell whether $REF is published, so nothing is built or moved. The registry read failed with: $(tr '\n' ' ' < "$ERR")"
231+
exit 1
232+
fi
214233
# A published digest is handed on whatever happens next: the digest-tag
215234
# step below keeps it served under a tag of its own.
216235
if [ -n "$DIGEST" ]; then echo "digest=$DIGEST" >> "$GITHUB_OUTPUT"; fi

0 commit comments

Comments
 (0)