From fd4c04d09543938b3c082d427b328bf30243c788 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Mon, 26 Oct 2026 17:29:08 +0000 Subject: [PATCH] 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 and latest; the sha-* tag is gone, so one digest belongs to exactly one version. build.yml: ansible-test reads tests/sanity/ignore-.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-.txt is appended). Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm --- .gitea/workflows/build.yml | 10 +++++++ .gitea/workflows/image.yml | 27 ++++++++++--------- CLAUDE.md | 10 ++++--- renovate.json | 4 +-- .../{ignore-2.19.txt => ignore-common.txt} | 0 5 files changed, 33 insertions(+), 18 deletions(-) rename tests/sanity/{ignore-2.19.txt => ignore-common.txt} (100%) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index e709568..0ae284a 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -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-.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-.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 diff --git a/.gitea/workflows/image.yml b/.gitea/workflows/image.yml index ff72509..a53ddb4 100644 --- a/.gitea/workflows/image.yml +++ b/.gitea/workflows/image.yml @@ -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 and latest. Pin consumers as # image:@sha256:; 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 (##: # clone , check out ). 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 { diff --git a/CLAUDE.md b/CLAUDE.md index 21ce282..025c8db 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -48,8 +48,12 @@ protection, or create tags: those are the operator's. - `ci` and `molecule-ubuntu2404`, built by `image.yml` with kaniko on push to `main` (never on pull requests) and pushed to `git.rkdr.net/mortis/`. - Each has a semver `version:` in the workflow's build matrix. A published version tag is never - moved (the job looks it up in the registry first): bump the version in the PR that changes - the image. + moved and never rebuilt (the job looks it up in the registry first and ends without building): + bump the version in the PR that changes the image. A new version is pushed as `` and + `latest`; there is no `sha-*` tag, so one digest belongs to exactly one version. +- `ansible-test sanity` ignores live in `tests/sanity/ignore-common.txt`; the Build job copies + it to the file name of the installed core version in its throwaway worktree (a committed + `ignore-.txt` is appended for findings of one version only). - Consumers pin `image:@sha256:` (`lint.yml`, `build.yml`, `molecule.yml`). A build prints the new digest; moving a pin is a reviewed edit, and every build has a new digest. @@ -64,7 +68,7 @@ protection, or create tags: those are the operator's. `renovate.json` is run by `.gitea/workflows/renovate.yml` (see below). Items marked unverified have not run yet. - **Policy:** minor and patch bumps automerge, majors are manual. `ansible-core` minor and major - are manual too (a new minor needs a `tests/sanity/ignore-2.NN.txt`), and `ansible-core` and + are manual too (a new minor can show new sanity findings), and `ansible-core` and `ansible-lint` bump in one group. Dockerfile base-image tag and digest bumps (`images/*/Dockerfile`) stay automergeable: Kamino is the untrusted side and the pin PR's CI exercises the new image. The `ubuntu` job container of `image.yml` never automerges: that job holds the registry push credential. diff --git a/renovate.json b/renovate.json index 0efaf2c..a074215 100644 --- a/renovate.json +++ b/renovate.json @@ -109,7 +109,7 @@ ] }, { - "description": "ansible-core and ansible-lint move together (the lint rules follow the core version). A new ansible-core minor also needs a tests/sanity/ignore-2.NN.txt, so its minor and major bumps are manual; patches of both follow the global automerge.", + "description": "ansible-core and ansible-lint move together (the lint rules follow the core version). A new ansible-core minor can bring new sanity findings (the shared tests/sanity/ignore-common.txt covers the known ones), so its minor and major bumps are manual; patches of both follow the global automerge.", "groupName": "ansible tooling", "matchDatasources": [ "pypi" @@ -120,7 +120,7 @@ ] }, { - "description": "ansible-core minor and major bumps: sanity needs a new tests/sanity/ignore-2.NN.txt, a human adds it.", + "description": "ansible-core minor and major bumps: a new core can bring new sanity findings, so a human reviews them.", "matchDatasources": [ "pypi" ], diff --git a/tests/sanity/ignore-2.19.txt b/tests/sanity/ignore-common.txt similarity index 100% rename from tests/sanity/ignore-2.19.txt rename to tests/sanity/ignore-common.txt