Merge pull request 'ci: skip published image versions and share one sanity ignore list' (#28) from feat/image-skip-published-shared-sanity-ignore into main
Reviewed-on: #28
This commit was merged in pull request #28.
This commit is contained in:
commit
d36c4a326e
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
|
||||
{
|
||||
|
||||
@@ -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/<name>`.
|
||||
- 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 `<version>` 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-<MAJOR.MINOR>.txt` is appended for findings of one version only).
|
||||
- Consumers pin `image:<version>@sha256:<digest>` (`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.
|
||||
|
||||
+2
-2
@@ -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"
|
||||
],
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user