ci: skip published image versions and share one sanity ignore list
image.yml: when the version tag is already in the registry the job now ends without building, instead of rebuilding under sha-* and latest. A new version is pushed as <version> and latest; the sha-* tag is gone, so one digest belongs to exactly one version. build.yml: ansible-test reads tests/sanity/ignore-<core MAJOR.MINOR>.txt, so every core bump needed a new file. The committed list is now ignore-common.txt, copied to the installed core's file name inside the throwaway worktree (a committed ignore-<MAJOR.MINOR>.txt is appended). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
1 parent
569b7bbe15
commit
fd4c04d095
5 files changed
+33
-18
No files matched your search
@@ -149,4 +149,14 @@ jobs:
|
||||
mkdir -p /tmp/ac/ansible_collections/mortis
|
||||
git worktree add --detach /tmp/ac/ansible_collections/mortis/kamino HEAD
|
||||
cd /tmp/ac/ansible_collections/mortis/kamino
|
||||
# ansible-test reads tests/sanity/ignore-<core MAJOR.MINOR>.txt and has no wildcard.
|
||||
# The committed ignore-common.txt applies to every core version: it is copied to the
|
||||
# file name of the installed core here, in this throwaway worktree only (plus the
|
||||
# lines of a committed ignore-<MAJOR.MINOR>.txt, for a finding of one version only).
|
||||
core="$(python3 -c 'import ansible.release as r; print(".".join(r.__version__.split(".")[:2]))')"
|
||||
case "$core" in [0-9]*.[0-9]*) ;; *) echo "::error::Cannot read the ansible-core version ($core)"; exit 1 ;; esac
|
||||
ignore="tests/sanity/ignore-${core}.txt"
|
||||
{ cat tests/sanity/ignore-common.txt; if [ -f "$ignore" ]; then cat "$ignore"; fi; } > /tmp/ignore.new
|
||||
mv /tmp/ignore.new "$ignore"
|
||||
echo "Sanity ignore list for ansible-core ${core}: $(wc -l < "$ignore") lines"
|
||||
ansible-test sanity --requirements --color no
|
||||
+14
-13
@@ -61,8 +61,9 @@ jobs:
|
||||
#
|
||||
# version: the semver tag of the image, independent of the Collection's releases.
|
||||
# Bump it in the same PR as an image change you want to publish under a new tag.
|
||||
# A version that is already in the registry is never moved (see the prepare step):
|
||||
# such a build is tagged sha-<12> and latest only. Pin consumers as
|
||||
# A version that is already in the registry is never moved and never rebuilt (see the
|
||||
# prepare step): that job ends without building, so every digest belongs to exactly one
|
||||
# version tag. A new version is pushed as <version> and latest. Pin consumers as
|
||||
# image:<version>@sha256:<digest>; the digest is what is enforced.
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -266,18 +267,19 @@ jobs:
|
||||
export SSL_CERT_DIR=/kaniko/ssl/certs
|
||||
registry="${SERVER_URL#https://}"
|
||||
image="${registry}/${IMAGE_PATH}"
|
||||
short="${SHA:0:12}"
|
||||
|
||||
# /kaniko is removed when the build finishes, so read the marker now.
|
||||
dests=(--destination "${image}:sha-${short}" --destination "${image}:latest")
|
||||
version_new=true
|
||||
# /kaniko is removed when the build finishes, so read the marker now. A published
|
||||
# version is neither moved nor rebuilt: an image whose inputs changed needs a new
|
||||
# version (Lint enforces it), and a rebuild of unchanged inputs would only give the
|
||||
# same tag a second digest.
|
||||
if [ -e /kaniko/version-published ]; then
|
||||
version_new=false
|
||||
echo "::warning::${image}:${IMAGE_VERSION} is already published and is not moved;" \
|
||||
"bump the version in image.yml to release this build under a new tag."
|
||||
else
|
||||
dests+=(--destination "${image}:${IMAGE_VERSION}")
|
||||
echo "${image}:${IMAGE_VERSION} is already published; nothing to build."
|
||||
if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
|
||||
echo "${IMAGE_PATH}:${IMAGE_VERSION} is already published; skipped." >> "$GITHUB_STEP_SUMMARY" || true
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
dests=(--destination "${image}:${IMAGE_VERSION}" --destination "${image}:latest")
|
||||
|
||||
# Context: this commit of this repository, cloned by kaniko (#<ref>#<sha>:
|
||||
# clone <ref>, check out <sha>). With a sub-path only that directory is the
|
||||
@@ -311,8 +313,7 @@ jobs:
|
||||
echo "::error::kaniko finished but no pushed image digest was found in its output."
|
||||
exit 1
|
||||
fi
|
||||
ref="${image}@${digest}"
|
||||
if [ "$version_new" = true ]; then ref="${image}:${IMAGE_VERSION}@${digest}"; fi
|
||||
ref="${image}:${IMAGE_VERSION}@${digest}"
|
||||
echo "Pinned reference: ${ref}"
|
||||
if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user