ci(images): assign image versions in CI and open the pin PR right after a push
Build / build (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 0s
Molecule / molecule (pull_request) Canceled after 0s

The image.yml matrix holds a hand-edited base (MAJOR.MINOR) per image instead
of a version. On main, scripts/next_image_version.py compares a checksum of the
image's inputs with the inputs-sha256 label of the newest published <base>.N
and the job publishes <base>.N+1 when they differ, or builds nothing when they
match. A published tag is still never moved.

renovate.yml runs live on the successful completion of Images (workflow_run),
so the pin pull request opens minutes after a push instead of on the schedule.

Removed: bump_image_versions.py and its tests, check_image_versions.py bump,
Lint's bump step, Renovate's postUpgradeTasks, and the bot-diff allowance for
matrix version lines.

Closes #165

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Defame1297 committed 2026-11-23 21:15:16 +00:00
1 parent 8da65bd08e
commit b12c990b6a
23 files changed
+484 -1064

No files matched your search

+8 -17
View File
@@ -16,8 +16,9 @@ When <head-ref> starts with `renovate/`, the diff of <base-ref>...HEAD may only
* .pre-commit-config.yaml: `rev:` lines (a tag, or a commit SHA with its `# frozen: <tag>` comment);
* images/<name>/Dockerfile: the tag and digest of FROM lines (the image name stays), and
the `uv==<version>` token of a line that holds one;
* .gitea/workflows/image.yml: the matrix `version:` lines, and the tag and digest of the
job containers' `job_image: ubuntu:...@sha256:...` lines (the name stays);
* .gitea/workflows/image.yml: the tag and digest of the job containers'
`job_image: ubuntu:...@sha256:...` lines (the name stays); CI assigns the image versions
and a human sets the matrix `base:`, so neither is the bot's to change;
* .gitea/workflows/{lint,build,molecule,gitea-release-key}.yml: the version and digest of a
`git.rkdr.net/mortis/<name>:<version>@sha256:<digest>` pin (the name stays), including
the MOLECULE_IMAGE value.
@@ -153,8 +154,6 @@ def reduce_dockerfile(line):
def reduce_image_yml(line):
if VERSION_LINE.match(line):
return "version"
m = UBUNTU_LINE.match(line)
return m[1] if m else None
@@ -191,7 +190,7 @@ def file_problem(path, removed, added):
removed,
added,
reduce_image_yml,
"a matrix `version:` or a `job_image:` ubuntu pin",
"a `job_image:` ubuntu pin",
)
if path in CONSUMERS:
return same_shape(
@@ -243,19 +242,11 @@ def parse_patch(text):
return [line for unused, line in removed], [line for unused, line in added]
def version_problem(removed, added):
"""A reason when the matrix `version:` lines were moved, lowered or swapped, else None.
Both lists are (line number, line); the changed lines must sit at the same line numbers."""
def moved_problem(removed, added):
"""A reason when a changed line changes position, else None; both lists are (line number, line).
A `job_image:` pin moved to another matrix entry would change which job runs on it."""
if [n for n, unused in removed] != [n for n, unused in added]:
return "moves or deletes a line (the changed lines must stay where they are)"
for (unused, old), (unused, new) in zip(removed, added):
old_m, new_m = VERSION_LINE.match(old), VERSION_LINE.match(new)
if (
old_m
and new_m
and civ.parse_version(new_m["v"]) <= civ.parse_version(old_m["v"])
):
return f"does not raise a version ({old_m['v']} -> {new_m['v']})"
return None
@@ -285,7 +276,7 @@ def check(entries, patch_of):
path, [line for unused, line in removed], [line for unused, line in added]
)
if not reason and path == civ.MATRIX_FILE:
reason = version_problem(removed, added)
reason = moved_problem(removed, added)
if reason:
problems.append(f"{path}: {reason}")
return problems