fix(scripts): read the image matrix without PyYAML #24

Merged
Defame1297 merged 2 commits from fix/bump-without-pyyaml into main 2026-10-26 17:02:49 +00:00
Owner

What

check_image_versions.matrix_of() no longer uses PyYAML. It is a small block-style reader for the matrix.include list of .gitea/workflows/image.yml. CLAUDE.md notes that the Renovate image's python3 has no PyYAML.

Why

Dry run 2453 (green) ran the postUpgradeTasks command python3 scripts/bump_image_versions.py origin/main in the Renovate -full image and it failed with ModuleNotFoundError: No module named 'yaml' (bump_image_versions imports check_image_versions, which imported yaml). Renovate reports that as an artifact error, so every bump PR would have opened without the version bump (red renovate/artifacts; Lint's bump check would then fail). The job stayed green.

Design

A purpose-built reader, not a YAML parser: it reads the single include: list and each entry's name, version, subpath, dockerfile. It fails closed with a one-line error on flow style, anchors, tags, block scalars, escapes, duplicate keys, numeric versions or names, and anything else it cannot read. The cost is a second reader that must stay in sync with the file; a test keeps it honest.

Verified

  • 123 script tests pass (python3 -B -m unittest discover -s tests/scripts); the commit hooks pass.
  • A test compares the reader with PyYAML on the real image.yml; another fails if either script imports yaml.
  • In a scratch clone with yaml blocked (sys.modules['yaml'] = None), bump_image_versions.py origin/main after an requirements-dev.txt change exits 0, prints bumped ci 0.2.0 -> 0.2.1 and changes only that version: line.

Not verified

  • That the post-upgrade task succeeds inside the real Renovate image: needs another dry run after merge (look for the version: change in the commit details of renovate/ansible-tooling).
  • The report check still does not fail on artifact errors (I do not know the report field); a failed bump shows only as a red renovate/artifacts status and a failing Lint bump check.

🤖 Generated with Claude Code

## What `check_image_versions.matrix_of()` no longer uses PyYAML. It is a small block-style reader for the `matrix.include` list of `.gitea/workflows/image.yml`. `CLAUDE.md` notes that the Renovate image's `python3` has no PyYAML. ## Why Dry run 2453 (green) ran the `postUpgradeTasks` command `python3 scripts/bump_image_versions.py origin/main` in the Renovate `-full` image and it failed with `ModuleNotFoundError: No module named 'yaml'` (`bump_image_versions` imports `check_image_versions`, which imported `yaml`). Renovate reports that as an artifact error, so every bump PR would have opened without the version bump (red `renovate/artifacts`; Lint's `bump` check would then fail). The job stayed green. ## Design A purpose-built reader, not a YAML parser: it reads the single `include:` list and each entry's `name`, `version`, `subpath`, `dockerfile`. It fails closed with a one-line error on flow style, anchors, tags, block scalars, escapes, duplicate keys, numeric versions or names, and anything else it cannot read. The cost is a second reader that must stay in sync with the file; a test keeps it honest. ## Verified - 123 script tests pass (`python3 -B -m unittest discover -s tests/scripts`); the commit hooks pass. - A test compares the reader with PyYAML on the real `image.yml`; another fails if either script imports `yaml`. - In a scratch clone with `yaml` blocked (`sys.modules['yaml'] = None`), `bump_image_versions.py origin/main` after an `requirements-dev.txt` change exits 0, prints `bumped ci 0.2.0 -> 0.2.1` and changes only that `version:` line. ## Not verified - That the post-upgrade task succeeds inside the real Renovate image: needs another dry run after merge (look for the `version:` change in the commit details of `renovate/ansible-tooling`). - The report check still does not fail on artifact errors (I do not know the report field); a failed bump shows only as a red `renovate/artifacts` status and a failing Lint `bump` check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 1 commit 2026-10-26 17:00:55 +00:00
fix(scripts): read the image matrix without PyYAML
Molecule / molecule (pull_request) Skipped
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 12s
eaa38cb03a
Dry run 2453 ran the bump post-upgrade task in the Renovate image and it
failed with ModuleNotFoundError: yaml, so every bump PR would have opened
without the version bump. matrix_of() is now a small block-style reader that
fails closed on anything else; a test compares it with PyYAML on the real
image.yml and another forbids importing yaml in the scripts.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Defame1297 added 1 commit 2026-10-26 17:02:16 +00:00
Merge branch 'main' into fix/bump-without-pyyaml
Molecule / molecule (pull_request) Skipped
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 12s
22540a2e84
Defame1297 scheduled this pull request to auto merge when all checks succeed 2026-10-26 17:02:26 +00:00
Defame1297 merged commit fc47d79025 into main 2026-10-26 17:02:49 +00:00
Defame1297 deleted branch fix/bump-without-pyyaml 2026-10-26 17:02:49 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#24