scripts/check_image_versions.py (no shebang, not executable, because ansible-test sanity rejects one on a non-module file):
pins mode: every git.rkdr.net/mortis/<name>:<version>@sha256:<digest> in the lint/build/molecule workflows must name an image in image.yml's build matrix, be well formed, and not be newer than the matrix version. Mentions are matched case-insensitively with an optional :port, a nested path and no tag, so Git.rkdr.net/mortis/ci:..., git.rkdr.net/Mortis/ci, git.rkdr.net:443/mortis/ci, git.rkdr.net/mortis/ci/sub and an untagged git.rkdr.net/mortis/ci are reported as malformed pins (URLs such as https://git.rkdr.net/mortis/kamino and SSH remotes are not mentions). lint.yml is a required consumer (error if missing); build.yml and molecule.yml are skipped when absent, and the success line lists the files checked.
bump <base-ref> mode: a diff against the merge-base that touches an image's inputs needs a higher version in the matrix; versions must not go backwards. Renames count as touching the old path. Paths are read with git diff -z as bytes; a path that is not valid UTF-8 fails with "path is not valid UTF-8".
The Dockerfile COPY/ADD reader fails closed with an error naming file and line on a source containing $, a quote or #, on an unparseable JSON form, and on a RUN --mount that binds the build context (cache/tmpfs/secret mounts and from= binds are fine). Continuation lines with trailing blanks after the backslash are joined; comment lines are skipped.
An empty or non-mapping image.yml says "image.yml is empty or not a mapping".
Strict semver, matrix validation, one ::error:: line per problem, no traceback.
Docstring "Known limits": merge-base collisions; tag-to-digest is a registry fact; renaming an image in the matrix in the same PR skips its bump check (the pins check still catches a stale pin); optional consumer files are skipped silently (now listed); duplicate YAML keys in a matrix entry are accepted; the COPY reader is not a Dockerfile parser.
tests/scripts/test_check_image_versions.py.
lint.yml: steps "Check image pins", "Check image versions were bumped" (pull_request only) and "Test the repository scripts".
galaxy.yml: tests/scripts added to build_ignore. Changelog fragment.
Verified
34 unit tests pass locally (python3 -I -m unittest discover -s tests/scripts): the 24 earlier ones plus 10 new (pin spellings, URLs not mentions, fail-closed COPY sources and mounts, OK cases still pass, continuation with blanks, empty image.yml, non-UTF-8 path, empty image.yml via CLI, Dockerfile error with file and line, lint.yml required and consumers listed).
pins run on the real workflows of this branch: ok, 3 consumers listed.
ansible-test sanity --test pep8 --test pylint --test shebang run locally on the script and the test file: clean.
CI at this head, steps observed: Build job success (including ansible-test sanity); Lint job success with steps pre-commit, "Check image pins", "Check image versions were bumped", "Test the repository scripts", gitleaks scan, Conventional Commits; Molecule job success.
Not verified
Whether a tag really points at the pinned digest (a registry fact).
Bumps colliding with a newer bump already on main (documented limit).
Any Dockerfile construct beyond the ones listed (heredoc COPY, ARG-expanded sources other than $) is not parsed.
Merge order
Touches lint.yml and galaxy.yml, as do #15 (lint.yml), #17 (lint.yml) and #18 (galaxy.yml, lint.yml). Merge this first; the others need trivial rebases of the same lines.
## What changed (head c3cd04e)
- `scripts/check_image_versions.py` (no shebang, not executable, because `ansible-test sanity` rejects one on a non-module file):
- `pins` mode: every `git.rkdr.net/mortis/<name>:<version>@sha256:<digest>` in the lint/build/molecule workflows must name an image in image.yml's build matrix, be well formed, and not be newer than the matrix version. Mentions are matched case-insensitively with an optional `:port`, a nested path and no tag, so `Git.rkdr.net/mortis/ci:...`, `git.rkdr.net/Mortis/ci`, `git.rkdr.net:443/mortis/ci`, `git.rkdr.net/mortis/ci/sub` and an untagged `git.rkdr.net/mortis/ci` are reported as malformed pins (URLs such as `https://git.rkdr.net/mortis/kamino` and SSH remotes are not mentions). lint.yml is a required consumer (error if missing); build.yml and molecule.yml are skipped when absent, and the success line lists the files checked.
- `bump <base-ref>` mode: a diff against the merge-base that touches an image's inputs needs a higher version in the matrix; versions must not go backwards. Renames count as touching the old path. Paths are read with `git diff -z` as bytes; a path that is not valid UTF-8 fails with "path is not valid UTF-8".
- The Dockerfile COPY/ADD reader fails closed with an error naming file and line on a source containing `$`, a quote or `#`, on an unparseable JSON form, and on a `RUN --mount` that binds the build context (cache/tmpfs/secret mounts and `from=` binds are fine). Continuation lines with trailing blanks after the backslash are joined; comment lines are skipped.
- An empty or non-mapping image.yml says "image.yml is empty or not a mapping".
- Strict semver, matrix validation, one `::error::` line per problem, no traceback.
- Docstring "Known limits": merge-base collisions; tag-to-digest is a registry fact; renaming an image in the matrix in the same PR skips its bump check (the pins check still catches a stale pin); optional consumer files are skipped silently (now listed); duplicate YAML keys in a matrix entry are accepted; the COPY reader is not a Dockerfile parser.
- `tests/scripts/test_check_image_versions.py`.
- lint.yml: steps "Check image pins", "Check image versions were bumped" (pull_request only) and "Test the repository scripts".
- galaxy.yml: `tests/scripts` added to build_ignore. Changelog fragment.
## Verified
- 34 unit tests pass locally (`python3 -I -m unittest discover -s tests/scripts`): the 24 earlier ones plus 10 new (pin spellings, URLs not mentions, fail-closed COPY sources and mounts, OK cases still pass, continuation with blanks, empty image.yml, non-UTF-8 path, empty image.yml via CLI, Dockerfile error with file and line, lint.yml required and consumers listed).
- `pins` run on the real workflows of this branch: ok, 3 consumers listed.
- `ansible-test sanity --test pep8 --test pylint --test shebang` run locally on the script and the test file: clean.
- CI at this head, steps observed: Build job success (including `ansible-test sanity`); Lint job success with steps pre-commit, "Check image pins", "Check image versions were bumped", "Test the repository scripts", gitleaks scan, Conventional Commits; Molecule job success.
## Not verified
- Whether a tag really points at the pinned digest (a registry fact).
- Bumps colliding with a newer bump already on main (documented limit).
- Any Dockerfile construct beyond the ones listed (heredoc COPY, ARG-expanded sources other than `$`) is not parsed.
## Merge order
Touches lint.yml and galaxy.yml, as do #15 (lint.yml), #17 (lint.yml) and #18 (galaxy.yml, lint.yml). Merge this first; the others need trivial rebases of the same lines.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add scripts/check_image_versions.py (pins mode, and bump mode on pull requests) with
unit tests, and run both plus the scripts' tests in lint.yml. tests/scripts is added
to galaxy.yml build_ignore.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Renamed or moved input files now count as touched (git diff --no-renames), so a
rename can no longer hide a changed image input. The base ref must be a plain ref
name and is passed after --end-of-options. Parse and git failures exit 1 with a
one-line message instead of a traceback. Prerelease versions compare per semver
(numeric identifiers numerically, numeric below alphanumeric). Whole-line YAML
comments are ignored when looking for pins.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Sanity (pylint, shebang) failed the Build check: drop the shebang and the
executable bit, simplify a comprehension, define functions instead of
assigning lambdas and pass check= to every subprocess.run.
Read the changed files with git diff -z so non-ASCII paths are compared
unquoted. Validate the matrix shape (non-empty list of mappings, string
name/version/dockerfile/subpath, no duplicate names) with one-line errors.
Match semver with fullmatch and reject leading zeros. Let a pin end at
, ) ] } or a quote. Document the known limits.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Pin mentions are matched case-insensitively with an optional port, a nested path
and no tag, so a mis-spelled or untagged pin is reported instead of ignored. The
Dockerfile COPY/ADD reader raises an error naming file and line on a source with
a variable, quote or comment character and on a RUN --mount of the build context,
and joins continuation lines with trailing blanks. A non-UTF-8 diff path and an
empty image.yml get their own messages, lint.yml is a required consumer, the
success line lists the consumers checked, and the docstring states the known limits.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What changed (head
c3cd04e)scripts/check_image_versions.py(no shebang, not executable, becauseansible-test sanityrejects one on a non-module file):pinsmode: everygit.rkdr.net/mortis/<name>:<version>@sha256:<digest>in the lint/build/molecule workflows must name an image in image.yml's build matrix, be well formed, and not be newer than the matrix version. Mentions are matched case-insensitively with an optional:port, a nested path and no tag, soGit.rkdr.net/mortis/ci:...,git.rkdr.net/Mortis/ci,git.rkdr.net:443/mortis/ci,git.rkdr.net/mortis/ci/suband an untaggedgit.rkdr.net/mortis/ciare reported as malformed pins (URLs such ashttps://git.rkdr.net/mortis/kaminoand SSH remotes are not mentions). lint.yml is a required consumer (error if missing); build.yml and molecule.yml are skipped when absent, and the success line lists the files checked.bump <base-ref>mode: a diff against the merge-base that touches an image's inputs needs a higher version in the matrix; versions must not go backwards. Renames count as touching the old path. Paths are read withgit diff -zas bytes; a path that is not valid UTF-8 fails with "path is not valid UTF-8".$, a quote or#, on an unparseable JSON form, and on aRUN --mountthat binds the build context (cache/tmpfs/secret mounts andfrom=binds are fine). Continuation lines with trailing blanks after the backslash are joined; comment lines are skipped.::error::line per problem, no traceback.tests/scripts/test_check_image_versions.py.tests/scriptsadded to build_ignore. Changelog fragment.Verified
python3 -I -m unittest discover -s tests/scripts): the 24 earlier ones plus 10 new (pin spellings, URLs not mentions, fail-closed COPY sources and mounts, OK cases still pass, continuation with blanks, empty image.yml, non-UTF-8 path, empty image.yml via CLI, Dockerfile error with file and line, lint.yml required and consumers listed).pinsrun on the real workflows of this branch: ok, 3 consumers listed.ansible-test sanity --test pep8 --test pylint --test shebangrun locally on the script and the test file: clean.ansible-test sanity); Lint job success with steps pre-commit, "Check image pins", "Check image versions were bumped", "Test the repository scripts", gitleaks scan, Conventional Commits; Molecule job success.Not verified
$) is not parsed.Merge order
Touches lint.yml and galaxy.yml, as do #15 (lint.yml), #17 (lint.yml) and #18 (galaxy.yml, lint.yml). Merge this first; the others need trivial rebases of the same lines.
🤖 Generated with Claude Code