diff --git a/renovate.json b/renovate.json index d174cfd..b2a517b 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,6 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "description": "Run by .gitea/workflows/renovate.yml on the kamino-runner. Policy: automerge minor and patch, majors by hand. Every bot pull request must pass scripts/check_bot_pr_diff.py (lint workflow), which allows only version, tag, digest and pin lines. The image-input rule runs scripts/bump_image_versions.py as a postUpgradeTasks command (allowed by RENOVATE_ALLOWED_COMMANDS of .gitea/workflows/renovate.yml, where Renovate runs).", + "description": "Run by .gitea/workflows/renovate.yml on the kamino-runner. Policy: automerge minor and patch, majors by hand. Every bot pull request must pass scripts/check_bot_pr_diff.py (lint workflow), which allows only version, tag, digest and pin lines. The top-level postUpgradeTasks runs scripts/bump_image_versions.py on every branch, lock refreshes included, which carry no package a packageRule could match (allowed by RENOVATE_ALLOWED_COMMANDS of .gitea/workflows/renovate.yml, where Renovate runs).", "extends": [ "config:recommended", ":enablePreCommit" @@ -22,6 +22,15 @@ "prHourlyLimit": 5, "minimumReleaseAge": "3 days", "minimumReleaseAgeBehaviour": "timestamp-optional", + "postUpgradeTasks": { + "commands": [ + "python3 scripts/bump_image_versions.py origin/main" + ], + "fileFilters": [ + ".gitea/workflows/image.yml" + ], + "executionMode": "branch" + }, "timezone": "UTC", "ansible-galaxy": { "managerFilePatterns": [ @@ -53,7 +62,7 @@ "customManagers": [ { "customType": "regex", - "description": "The uv pin that installs the build-stage Python interpreters of the ci image (images/ci/Dockerfile). It is an image input: the version bump comes from scripts/bump_image_versions.py via postUpgradeTasks (rule below).", + "description": "The uv pin that installs the build-stage Python interpreters of the ci image (images/ci/Dockerfile). It is an image input: the version bump comes from scripts/bump_image_versions.py via the top-level postUpgradeTasks.", "managerFilePatterns": [ "/^images/ci/Dockerfile$/" ], @@ -90,27 +99,12 @@ ], "packageRules": [ { - "description": "Dockerfile base-image tag and digest bumps (images/*/Dockerfile) MAY automerge. Kamino is the untrusted side and the bump pull request's own CI exercises the new image before the merge. Placed first so the major-version rule below still turns automerge off. The image version bump in image.yml comes from scripts/bump_image_versions.py via postUpgradeTasks (rule below).", + "description": "Dockerfile base-image tag and digest bumps (images/*/Dockerfile) MAY automerge. Kamino is the untrusted side and the bump pull request's own CI exercises the new image before the merge. Placed first so the major-version rule below still turns automerge off. The image version bump in image.yml comes from scripts/bump_image_versions.py via the top-level postUpgradeTasks.", "matchManagers": [ "dockerfile" ], "automerge": true }, - { - "description": "Every update runs scripts/bump_image_versions.py against origin/main as a postUpgradeTasks command (the base ref and clone depth in Renovate's checkout are verified by the first dry run). The rule matches every package (matchPackageNames *, which strict validation requires as a selector) on purpose: with executionMode branch only the FIRST upgrade's postUpgradeTasks of a branch counts and a branch can carry several upgrades; the script is a no-op when no image input (requirements-dev.txt, requirements.yml, .pre-commit-config.yaml, images/**) changed and otherwise makes the PATCH bump of the image version in image.yml. The command must match RENOVATE_ALLOWED_COMMANDS in renovate.yml exactly.", - "matchPackageNames": [ - "*" - ], - "postUpgradeTasks": { - "commands": [ - "python3 scripts/bump_image_versions.py origin/main" - ], - "fileFilters": [ - ".gitea/workflows/image.yml" - ], - "executionMode": "branch" - } - }, { "description": "The Renovate job container of renovate.yml runs with the job token: hand-bumped, never by the bot (the bot-diff gate would refuse a change to that file anyway).", "matchFileNames": [ diff --git a/scripts/bump_image_versions.py b/scripts/bump_image_versions.py index 79a4802..ac088df 100644 --- a/scripts/bump_image_versions.py +++ b/scripts/bump_image_versions.py @@ -17,8 +17,9 @@ order; an entry that cannot be parsed unambiguously is an error); comments, quot the rest of the file are kept. Untracked files count as inputs unless git ignores them, so a cache under images/ must be in .gitignore. -It runs as a Renovate `postUpgradeTasks` command: renovate.json sets it on a catch-all -packageRule (matches every package, executionMode branch, fileFilters limited to .gitea/workflows/image.yml), +It runs as a Renovate `postUpgradeTasks` command: renovate.json sets it at the top level +(so it runs on every branch, a lock refresh with no package included), with executionMode branch and fileFilters limited to +.gitea/workflows/image.yml, allowed by RENOVATE_ALLOWED_COMMANDS of .gitea/workflows/renovate.yml. It is a no-op when no image input changed, so a dependency bump that changes an image input carries its version bump and passes the `bump` check without a human edit.