ci(renovate): bump the molecule-controller pins like the ci ones
Renovate's pip-compile manager now reads requirements-molecule.lock, and its uv manager reads the controller Dockerfile's uv pin. The bot-PR guard holds the controller requirements and lock to the same rules as requirements-dev.txt and its lock, so the bot's pull requests for them are neither refused nor freer than the ci ones. The ansible tooling group spans both locks, so one pull request moves both ansible-core pins, which check_image_versions.py holds equal. Checked with renovate 44.161.0 --platform=local: it extracts requirements-molecule.txt with requirements-molecule.lock, and the uv pin of images/molecule-controller/Dockerfile. Refs #477 Assisted-by: Claude Code
This commit is contained in:
1 parent
fd448d7e9e
commit
0fb4fd70ee
3 files changed
+40
-13
No files matched your search
+6
-4
@@ -31,7 +31,8 @@
|
||||
},
|
||||
"pip-compile": {
|
||||
"managerFilePatterns": [
|
||||
"/^requirements-dev\\.lock$/"
|
||||
"/^requirements-dev\\.lock$/",
|
||||
"/^requirements-molecule\\.lock$/"
|
||||
]
|
||||
},
|
||||
"pre-commit": {
|
||||
@@ -53,9 +54,10 @@
|
||||
"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 merge publishes a new ci version.",
|
||||
"description": "The uv pin that installs the build-stage Python interpreters of the ci and molecule-controller images (their Dockerfiles). It is an image input: the merge publishes a new version of each.",
|
||||
"managerFilePatterns": [
|
||||
"/^images/ci/Dockerfile$/"
|
||||
"/^images/ci/Dockerfile$/",
|
||||
"/^images/molecule-controller/Dockerfile$/"
|
||||
],
|
||||
"matchStrings": [
|
||||
"\\buv==(?<currentValue>[0-9][0-9A-Za-z.+!_-]*)"
|
||||
@@ -124,7 +126,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "ansible-core and ansible-lint move together (the lint rules follow the core version). Minor and patch bumps automerge like the rest, majors are manual. A new ansible-core minor can bring new sanity findings: the shared tests/sanity/ignore-common.txt covers the known ones, and the Build check (ansible-test sanity) is the gate, so a bump that shows new findings stays red and is not merged.",
|
||||
"description": "ansible-core and ansible-lint move together (the lint rules follow the core version). Minor and patch bumps automerge like the rest, majors are manual. A new ansible-core minor can bring new sanity findings: the shared tests/sanity/ignore-common.txt covers the known ones, and the Build check (ansible-test sanity) is the gate, so a bump that shows new findings stays red and is not merged. The group spans requirements-dev.lock and requirements-molecule.lock, so one pull request moves both ansible-core pins, which check_image_versions.py pins holds equal.",
|
||||
"groupName": "ansible tooling",
|
||||
"matchDatasources": [
|
||||
"pypi"
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
|
||||
When <head-ref> starts with `renovate/`, the diff of <base-ref>...HEAD may only touch:
|
||||
|
||||
* requirements-dev.txt: pinned `name==version` lines, the same packages before and after;
|
||||
* requirements-dev.lock (pip-compile --generate-hashes output): `name==version` entries,
|
||||
`--hash=sha256:<64 hex>` lines and plain `# via` or prose comments, nothing else; packages may
|
||||
be added or removed (a transitive dependency), but the `# pip-compile ...` command in the
|
||||
header, which Renovate runs again, must stay as it is;
|
||||
* requirements-dev.txt and requirements-molecule.txt: pinned `name==version` lines, the same
|
||||
packages before and after;
|
||||
* requirements-dev.lock and requirements-molecule.lock (pip-compile --generate-hashes output):
|
||||
`name==version` entries, `--hash=sha256:<64 hex>` lines and plain `# via` or prose comments,
|
||||
nothing else; packages may be added or removed (a transitive dependency), but the
|
||||
`# pip-compile ...` command in the header, which Renovate runs again, must stay as it is;
|
||||
* requirements.yml and extensions/molecule/requirements.yml: `version:` lines (the collection
|
||||
names, and every other line, stay);
|
||||
* .pre-commit-config.yaml: `rev:` lines (a tag, or a commit SHA with its `# frozen: <tag>` comment);
|
||||
@@ -69,6 +70,9 @@ UBUNTU_LINE = re.compile(
|
||||
)
|
||||
DOCKERFILE = re.compile(r"images/[^/]+/Dockerfile")
|
||||
COLLECTION_PINS = {"requirements.yml", "extensions/molecule/requirements.yml"}
|
||||
# Lint's and the molecule-controller image's requirements, each with its pip-compile lock.
|
||||
REQUIREMENTS = {"requirements-dev.txt", "requirements-molecule.txt"}
|
||||
LOCKS = {"requirements-dev.lock", "requirements-molecule.lock"}
|
||||
CONSUMERS = {
|
||||
".gitea/workflows/lint.yml",
|
||||
".gitea/workflows/build.yml",
|
||||
@@ -108,7 +112,7 @@ def reduce_version(line):
|
||||
return "version" if VERSION_LINE.match(line) else None
|
||||
|
||||
|
||||
# requirements-dev.lock: an entry (with an optional environment marker), a hash, or a comment.
|
||||
# A lock: an entry (with an optional environment marker), a hash, or a comment.
|
||||
# The marker and the prose comment use a small character set: no backslash, quote of a shell, `$` or `--`.
|
||||
LOCK_ENTRY = re.compile(
|
||||
r"^[A-Za-z0-9][A-Za-z0-9._-]*==[0-9][0-9A-Za-z.+!_-]*"
|
||||
@@ -122,7 +126,7 @@ LOCK_COMMENT = re.compile(
|
||||
|
||||
|
||||
def lock_problem(removed, added):
|
||||
"""None when every changed line of requirements-dev.lock is an entry, a hash or a plain comment and
|
||||
"""None when every changed line of a lock is an entry, a hash or a plain comment and
|
||||
the `# pip-compile ...` command line is the same on both sides."""
|
||||
for line in removed + added:
|
||||
if LOCK_COMMAND.match(line):
|
||||
@@ -165,14 +169,14 @@ def reduce_pin(line):
|
||||
|
||||
def file_problem(path, removed, added):
|
||||
"""One-line reason why the change to `path` is not allowed for a bot, or None."""
|
||||
if path == "requirements-dev.txt":
|
||||
if path in REQUIREMENTS:
|
||||
return same_shape(
|
||||
removed,
|
||||
added,
|
||||
reduce_requirement,
|
||||
"a pinned `name==version` line of the same package",
|
||||
)
|
||||
if path == "requirements-dev.lock":
|
||||
if path in LOCKS:
|
||||
return lock_problem(removed, added)
|
||||
if path in COLLECTION_PINS:
|
||||
return same_shape(removed, added, reduce_version, "a `version:` line")
|
||||
|
||||
@@ -68,6 +68,27 @@ class LockRuleTest(unittest.TestCase):
|
||||
]
|
||||
self.assertIsNone(cbd.file_problem("requirements-dev.lock", removed, added))
|
||||
|
||||
def test_the_controller_lock_follows_the_lock_rule(self):
|
||||
removed = ["molecule==26.11.0 \\", f" --hash=sha256:{H1}"]
|
||||
added = ["molecule==26.12.0 \\", f" --hash=sha256:{H2}"]
|
||||
self.assertIsNone(
|
||||
cbd.file_problem("requirements-molecule.lock", removed, added)
|
||||
)
|
||||
self.assertIsNotNone(
|
||||
cbd.file_problem(
|
||||
"requirements-molecule.lock", [], ["--index-url https://evil/simple"]
|
||||
)
|
||||
)
|
||||
|
||||
def test_the_controller_requirements_follow_the_pin_rule(self):
|
||||
path = "requirements-molecule.txt"
|
||||
self.assertIsNone(
|
||||
cbd.file_problem(path, ["molecule==26.11.0"], ["molecule==26.12.0"])
|
||||
)
|
||||
self.assertIsNotNone(
|
||||
cbd.file_problem(path, ["molecule==26.11.0"], ["evil==1.0"])
|
||||
)
|
||||
|
||||
def test_the_header_command_may_not_change(self):
|
||||
old = "# pip-compile --generate-hashes --output-file=requirements-dev.lock requirements-dev.txt"
|
||||
new = old.replace("--generate-hashes", "--index-url=https://evil/simple")
|
||||
|
||||
Reference in new issue
Block a user