Files
cozystack/hack/collect-images.sh
Aleksei Sviridkin 82aa8a048d ci(release): fail an rc on any single-arch image its e2e pulled
The release gate reads only refs the tree pins by digest, so an image
a vendored chart renders from its defaults, or one an operator
launches, can still be amd64 only. The rc e2e now reads what the
three Talos nodes actually pulled from their image stores, each by the
digest the pull resolved to, and runs verify-multiarch on that list
before the sandbox is torn down. The image store, not the running
pods, because the tests delete what they create.

collect-images.sh writes that list only when every node answered, so
a node that could not be read fails the audit instead of passing the
images only it held. A pre-release fails on the audit; a stable tag's
run only warns, as it ships its rc's images unchanged.

The audit runs in the tree of the tag under test, so a tag cut before
it existed has neither the script nor the image list. That run warns
and skips instead of failing, so such an rc can still be re-validated
from main; a tree that has the script and no list still fails.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-28 01:32:37 +03:00

28 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# image-refs.txt is what the release's runtime multi-arch audit checks, so it
# is written only when every node answered: a list missing a node would pass
# the images only that node pulled.
rm -f images.tmp image-refs.txt
complete=1
for node in 11 12 13; do
talosctl -n 192.168.123.${node} -e 192.168.123.${node} images ls >> images.tmp || complete=0
talosctl -n 192.168.123.${node} -e 192.168.123.${node} images --namespace system ls >> images.tmp || complete=0
done
while read _ name sha _ ; do echo $sha $name ; done < images.tmp | sort -u > images.txt
# <repo>@<digest>, the digest being what the node's pull resolved to: an index
# for a multi-arch image. A name that is itself a digest is an image ID alias
# and names no repository.
if [ "$complete" != 1 ]; then
echo "collect-images: a node could not be read; image-refs.txt not written" >&2
exit 0
fi
awk '$3 ~ /^sha256:/ && $2 !~ /^sha256:/ {
name = $2
sub(/@.*/, "", name)
if (match(name, /:[^\/]*$/)) name = substr(name, 1, RSTART - 1)
print name "@" $3
}' images.tmp | sort -u > image-refs.txt