From 8719271d058346ff791144eaca642f7612c36bbe Mon Sep 17 00:00:00 2001 From: Claude Code AI - Gitea MCP <3+claude@noreply.git.rkdr.net> Date: Sun, 25 Oct 2026 10:39:09 +0000 Subject: [PATCH 1/2] fix(image): read the pushed digest from the kaniko log, not from /kaniko The first run on main built and pushed the image, then failed on `read -r digest < /kaniko/digest`: the executor replaces the job container's filesystem with the built image and removes /kaniko, so the digest file and the credential-method file are gone by then. Take the digest from the "Pushed @sha256:" log line into a shell variable, validate its shape, and drop the credential-method echo (the prepare step already logs the credential in use). Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm --- .gitea/workflows/image.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/image.yml b/.gitea/workflows/image.yml index ab37575..a6c8b54 100644 --- a/.gitea/workflows/image.yml +++ b/.gitea/workflows/image.yml @@ -236,29 +236,39 @@ jobs: # Context: this commit of this repository, cloned by kaniko (##: # clone , check out ). The Dockerfile has no COPY, so only it is read. - /kaniko/executor \ + # + # When it finishes the executor has replaced the job container's filesystem with + # the built image and removed /kaniko, so nothing written there (a --digest-file, + # the credential method) can be read back. Take the digest from its + # "Pushed @sha256:" log line into a variable of this shell, which + # needs only builtins by then. + digest="" + while IFS= read -r line; do + printf '%s\n' "$line" + case "$line" in + *"Pushed "*"@sha256:"*) digest="sha256:${line##*@sha256:}" ;; + esac + done < <(/kaniko/executor \ --context "git://${registry}/${REPO}.git#${REF}#${SHA}" \ --context-sub-path images/molecule-ubuntu2404 \ --dockerfile Dockerfile \ "${dests[@]}" \ - --digest-file /kaniko/digest \ --snapshot-mode=redo \ --cache=false \ --push-retry 3 \ --image-fs-extract-retry 3 \ - --force + --force 2>&1) + wait "$!" - # The filesystem now holds the built image; read and echo are builtins. - read -r digest < /kaniko/digest - read -r method < /kaniko/credential-method - echo "Pushed with credential: $method" + if ! [[ "$digest" =~ ^sha256:[0-9a-f]{64}$ ]]; then + echo "::error::kaniko finished but no pushed image digest was found in its output." + exit 1 + fi echo "Pinned reference: ${image}@${digest}" if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then { echo "### molecule-ubuntu2404 pushed" echo - echo "Credential: ${method}" - echo echo "Pin it by digest: \`${image}@${digest}\`" } >> "$GITHUB_STEP_SUMMARY" || true fi -- 2.43.0 From 1ecd0602398f5de5dc60214bc019ee23fd7072b3 Mon Sep 17 00:00:00 2001 From: Claude Code AI - Gitea MCP <3+claude@noreply.git.rkdr.net> Date: Sun, 25 Oct 2026 10:39:20 +0000 Subject: [PATCH 2/2] fix(image): ignore anything after the 64 hex digits of the logged digest Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm --- .gitea/workflows/image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/image.yml b/.gitea/workflows/image.yml index a6c8b54..84a5906 100644 --- a/.gitea/workflows/image.yml +++ b/.gitea/workflows/image.yml @@ -246,7 +246,7 @@ jobs: while IFS= read -r line; do printf '%s\n' "$line" case "$line" in - *"Pushed "*"@sha256:"*) digest="sha256:${line##*@sha256:}" ;; + *"Pushed "*"@sha256:"*) digest="sha256:${line##*@sha256:}"; digest="${digest:0:71}" ;; esac done < <(/kaniko/executor \ --context "git://${registry}/${REPO}.git#${REF}#${SHA}" \ -- 2.43.0