fix(images): name the registry client and report a refused request
Build / build (pull_request) Successful in 15s
Lint / lint (pull_request) Successful in 59s
Molecule / molecule (pull_request) Successful in 2s

The first Images run after #165 failed: the runner's first registry request
from next_image_version.py got HTTP 403, as a bare traceback, while the same
request works from elsewhere and curl reaches the host in the same job. The
suspected cause, a bot filter refusing Python's default User-Agent, is not
confirmed.

Every registry request, the token request included, now sends its own
User-Agent. Every HTTP error becomes a RegistryError that names the status and
the visible text of the response body, and main prints it as one ::error::
line and exits 1. The client logs in at most once, so an empty token cannot
loop. The script takes the registry URL, so the tests drive it against a local
fake registry.

Refs #165

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Defame1297 committed 2026-11-23 22:13:05 +00:00
1 parent 5af66ed941
commit 30316c5a7d
3 files changed
+193 -28

No files matched your search

+1 -1
View File
@@ -165,7 +165,7 @@ jobs:
| tar -xz -C /tmp/src --strip-components=1
# -B: no bytecode left behind to break the pristine-filesystem check below.
env -u PAT_USER -u PAT_TOKEN -u JOB_TOKEN python3 -B -E -s \
/tmp/src/scripts/next_image_version.py /tmp/src "$IMAGE_NAME" "$registry" > /kaniko/image-version
/tmp/src/scripts/next_image_version.py /tmp/src "$IMAGE_NAME" "$SERVER_URL" > /kaniko/image-version
if [ -s /kaniko/image-version ]; then
read -r IMAGE_VERSION _ < /kaniko/image-version
echo "Inputs of ${IMAGE_PATH} changed: publishing ${IMAGE_VERSION}."