feat(image): describe every image: labels, a readme page and build metadata

The registry page shows the description as plain text, every label, and links to source,
documentation and licence; it renders no readme. Each Dockerfile now carries one label
block (title, description, source, url, documentation, licenses, authors, base.name and
net.rkdr.mortis.purpose/contents/usage), the build adds version, revision and created, and
docs/images/<name>.md says what the image is for, what it contains and how to use it.
check_image_versions.py pins fails when a label or that page is missing. The labels are
image inputs, so the three images get their PATCH bump.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
Defame1297andClaude Sonnet 5.5 committed 2026-10-26 19:27:15 +00:00
1 parent 01f90c1f6a
commit c3c665e799
11 files changed
+363 -11

No files matched your search

+50
View File
@@ -21,6 +21,8 @@ pins No file under .gitea/workflows may mention `git.rkdr.net/defame1297/`: the
Every matrix entry names its job container (`job_image: ubuntu:<release>@sha256:...`), and
that release must equal the release of the `FROM ubuntu:` lines of its Dockerfile: kaniko
runs inside the job container and unpacks the image over it.
Every image's Dockerfile carries the labels its registry page shows (REQUIRED_LABELS) and
links to docs/images/<name>.md, which must exist.
Offline: whether the tag points at the digest is a registry fact, see the
"unverified" note in the PR description.
bump Fails when the diff <base-ref>...HEAD touches an input of an image without a
@@ -387,6 +389,53 @@ def check_job_images(matrix, read_file, workflow_text):
return errors
REQUIRED_LABELS = ("org.opencontainers.image.title", "org.opencontainers.image.description",
"org.opencontainers.image.source", "org.opencontainers.image.url",
"org.opencontainers.image.documentation", "org.opencontainers.image.licenses",
"org.opencontainers.image.authors", "net.rkdr.mortis.purpose",
"net.rkdr.mortis.contents", "net.rkdr.mortis.usage")
LABEL_KEY_RE = re.compile(r"(?:^|\s)(?P<key>[A-Za-z0-9][A-Za-z0-9._-]*)=")
def dockerfile_labels(dockerfile_text):
"""{key: raw value text} of the LABEL instructions of a Dockerfile (quotes kept)."""
labels = {}
for unused, line in _instructions(dockerfile_text):
parts = line.split(None, 1)
if len(parts) == 2 and parts[0].upper() == "LABEL":
rest = parts[1]
keys = list(LABEL_KEY_RE.finditer(rest))
for n, m in enumerate(keys):
end = keys[n + 1].start() if n + 1 < len(keys) else len(rest)
labels[m["key"]] = rest[m.end():end].strip().rstrip("\\").strip()
return labels
def check_image_metadata(matrix, read_file, exists):
"""Errors where an image lacks the labels its registry page shows, or the document they link to."""
errors = []
for name, entry in matrix.items():
path = str(pathlib.PurePosixPath(entry["subpath"]) / entry["dockerfile"]) if entry["subpath"] else entry["dockerfile"]
try:
labels = dockerfile_labels(read_file(path))
except OSError as exc:
errors.append(f"image '{name}': cannot read {path}: {exc}")
continue
missing = [key for key in REQUIRED_LABELS if not labels.get(key, "").strip("\"' ")]
if missing:
errors.append(f"image '{name}': {path} lacks the label(s) {', '.join(missing)}")
doc = f"docs/images/{name}.md"
link = labels.get("org.opencontainers.image.documentation", "")
if link and not link.strip("\"' ").endswith(f"/{doc}"):
errors.append(f"image '{name}': the documentation label must link to {doc}")
if not exists(doc):
errors.append(f"image '{name}': {doc} is missing (the documentation label links to it)")
title = labels.get("org.opencontainers.image.title", "").strip("\"' ")
if title and title != name:
errors.append(f"image '{name}': the title label is '{title}', expected the image name")
return errors
def changed_images(head_matrix, changed, read_head_file):
"""{name: sorted touched inputs} for each image of the matrix whose inputs are in `changed`."""
result = {}
@@ -477,6 +526,7 @@ def run(argv):
texts = {f: pathlib.Path(f).read_text() for f in CONSUMERS if pathlib.Path(f).exists()}
errors = check_pins(matrix, texts)
errors += check_job_images(matrix, lambda p: pathlib.Path(p).read_text(), image_yml)
errors += check_image_metadata(matrix, lambda p: pathlib.Path(p).read_text(), lambda p: pathlib.Path(p).is_file())
workflows = sorted(pathlib.Path(WORKFLOW_DIR).glob("*.y*ml")) if pathlib.Path(WORKFLOW_DIR).is_dir() else []
errors += check_foreign_images({str(f): f.read_text() for f in workflows})
note = " (checked: " + ", ".join(texts) + ")"