fix(image): no single quote in a label (kaniko rejects it) and a check for it #41
No files matched your search
@@ -86,7 +86,7 @@ jobs:
|
||||
dockerfile: Dockerfile
|
||||
job_image: ubuntu:26.04@sha256:c098726dd9b9733f3e885f8de0ef375206a311b0a317eadc40d347b1115fb944
|
||||
- name: ci
|
||||
version: 0.2.6
|
||||
version: 0.2.7
|
||||
subpath: ""
|
||||
dockerfile: images/ci/Dockerfile
|
||||
job_image: ubuntu:26.04@sha256:c098726dd9b9733f3e885f8de0ef375206a311b0a317eadc40d347b1115fb944
|
||||
|
||||
@@ -115,7 +115,7 @@ RUN set -eu; \
|
||||
FROM os AS final
|
||||
|
||||
LABEL org.opencontainers.image.title="ci" \
|
||||
org.opencontainers.image.description="CI tooling image for the mortis.kamino Ansible Collection: the Lint and Build workflows run in it, so a job only checks out the code and runs. It bakes in ansible-core, ansible-lint, pre-commit with every hook environment of the repository, antsibull-changelog, galaxy-importer, reuse, git, shellcheck, Python 3.11 and 3.13 next to the distribution's python3 and primed ansible-test sanity virtualenvs. Use it as a job container pinned by tag and digest; it has no Node, so clone with git." \
|
||||
org.opencontainers.image.description="CI tooling image for the mortis.kamino Ansible Collection: the Lint and Build workflows run in it, so a job only checks out the code and runs. It bakes in ansible-core, ansible-lint, pre-commit with every hook environment of the repository, antsibull-changelog, galaxy-importer, reuse, git, shellcheck, Python 3.11 and 3.13 next to the distribution python3 and primed ansible-test sanity virtualenvs. Use it as a job container pinned by tag and digest; it has no Node, so clone with git." \
|
||||
org.opencontainers.image.source="https://git.rkdr.net/mortis/kamino" \
|
||||
org.opencontainers.image.url="https://git.rkdr.net/mortis/kamino" \
|
||||
org.opencontainers.image.documentation="https://git.rkdr.net/mortis/kamino/src/branch/main/docs/images/ci.md" \
|
||||
|
||||
@@ -441,6 +441,10 @@ def check_image_metadata(matrix, read_file, size_of):
|
||||
missing = [key for key in REQUIRED_LABELS if not labels.get(key, "").strip()]
|
||||
if missing:
|
||||
errors.append(f"image '{name}': the last stage of {path} lacks the label(s) {', '.join(missing)}")
|
||||
quoted = sorted(key for key, value in labels.items() if "'" in value)
|
||||
if quoted:
|
||||
errors.append(f"image '{name}': the label(s) {', '.join(quoted)} contain a single quote, which kaniko's "
|
||||
"LABEL parser rejects (run 2556); reword the text")
|
||||
doc = f"docs/images/{name}.md"
|
||||
source = labels.get("org.opencontainers.image.source", "").strip()
|
||||
link = labels.get("org.opencontainers.image.documentation", "").strip()
|
||||
|
||||
@@ -311,6 +311,8 @@ class PureTest(unittest.TestCase):
|
||||
self.assertIn("documentation label must be", check()[0])
|
||||
files["images/ci/Dockerfile"] = labelled("renamed")
|
||||
self.assertTrue(any("expected the image name" in e for e in check()))
|
||||
files["images/ci/Dockerfile"] = labelled("ci").replace('net.rkdr.mortis.usage="x"', 'net.rkdr.mortis.usage="the distribution\'s tool"')
|
||||
self.assertIn("contain a single quote", check()[0])
|
||||
files["images/ci/Dockerfile"] = labelled("ci").replace('base.name="ubuntu:24.04"', 'base.name="ubuntu:22.04"')
|
||||
self.assertIn("base.name label 'ubuntu:22.04' differs", check()[0])
|
||||
files["images/ci/Dockerfile"] = labelled("ci")
|
||||
|
||||
Reference in new issue
Block a user