ci(renovate): track requirements.yml and allow its version bumps
Enable Renovate's ansible-galaxy manager for requirements.yml and let a bot pull request change only the version: lines of that file (check_bot_pr_diff.py), so a collection bump can automerge like the other pins while a changed name or source still fails the gate (#118). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
This commit is contained in:
1 parent
8fb7148129
commit
87b23ea4f3
3 files changed
+26
No files matched your search
@@ -11,6 +11,7 @@
|
|||||||
"semanticCommitScope": "deps",
|
"semanticCommitScope": "deps",
|
||||||
"enabledManagers": [
|
"enabledManagers": [
|
||||||
"pip_requirements",
|
"pip_requirements",
|
||||||
|
"ansible-galaxy",
|
||||||
"pre-commit",
|
"pre-commit",
|
||||||
"github-actions",
|
"github-actions",
|
||||||
"dockerfile",
|
"dockerfile",
|
||||||
@@ -26,6 +27,11 @@
|
|||||||
"/^requirements-dev\\.txt$/"
|
"/^requirements-dev\\.txt$/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"ansible-galaxy": {
|
||||||
|
"managerFilePatterns": [
|
||||||
|
"/^requirements\\.yml$/"
|
||||||
|
]
|
||||||
|
},
|
||||||
"pre-commit": {
|
"pre-commit": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"managerFilePatterns": [
|
"managerFilePatterns": [
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
When <head-ref> starts with `renovate/`, the diff of <base-ref>...HEAD may only touch:
|
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.txt: pinned `name==version` lines, the same packages before and after;
|
||||||
|
* requirements.yml: `version:` lines (the collection names, and every other line, stay);
|
||||||
* .pre-commit-config.yaml: `rev:` lines;
|
* .pre-commit-config.yaml: `rev:` lines;
|
||||||
* images/<name>/Dockerfile: the tag and digest of FROM lines (the image name stays), and
|
* images/<name>/Dockerfile: the tag and digest of FROM lines (the image name stays), and
|
||||||
the `uv==<version>` token of a line that holds one;
|
the `uv==<version>` token of a line that holds one;
|
||||||
@@ -93,6 +94,10 @@ def reduce_requirement(line):
|
|||||||
return m[1].lower() if m else None
|
return m[1].lower() if m else None
|
||||||
|
|
||||||
|
|
||||||
|
def reduce_version(line):
|
||||||
|
return "version" if VERSION_LINE.match(line) else None
|
||||||
|
|
||||||
|
|
||||||
def reduce_rev(line):
|
def reduce_rev(line):
|
||||||
return "rev" if REV_LINE.match(line) else None
|
return "rev" if REV_LINE.match(line) else None
|
||||||
|
|
||||||
@@ -127,6 +132,8 @@ def file_problem(path, removed, added):
|
|||||||
reduce_requirement,
|
reduce_requirement,
|
||||||
"a pinned `name==version` line of the same package",
|
"a pinned `name==version` line of the same package",
|
||||||
)
|
)
|
||||||
|
if path == "requirements.yml":
|
||||||
|
return same_shape(removed, added, reduce_version, "a `version:` line")
|
||||||
if path == ".pre-commit-config.yaml":
|
if path == ".pre-commit-config.yaml":
|
||||||
return same_shape(removed, added, reduce_rev, "a `rev:` line")
|
return same_shape(removed, added, reduce_rev, "a `rev:` line")
|
||||||
if DOCKERFILE.fullmatch(path):
|
if DOCKERFILE.fullmatch(path):
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import check_bot_pr_diff as cbd
|
|||||||
D1, D2 = "sha256:" + "a" * 64, "sha256:" + "b" * 64
|
D1, D2 = "sha256:" + "a" * 64, "sha256:" + "b" * 64
|
||||||
FILES = {
|
FILES = {
|
||||||
"requirements-dev.txt": "# pins\nansible-core==2.19.14\nreuse==6.2.0\n",
|
"requirements-dev.txt": "# pins\nansible-core==2.19.14\nreuse==6.2.0\n",
|
||||||
|
"requirements.yml": "---\ncollections:\n - name: community.general\n version: 14.0.0\n",
|
||||||
".pre-commit-config.yaml": "repos:\n - repo: https://github.com/x/y\n rev: v1.0.0\n hooks:\n - id: y\n",
|
".pre-commit-config.yaml": "repos:\n - repo: https://github.com/x/y\n rev: v1.0.0\n hooks:\n - id: y\n",
|
||||||
"images/ci/Dockerfile": f"FROM ubuntu:24.04@{D1} AS os\nRUN pip install uv==0.13.5 \\\n && echo hi\nRUN echo x\n",
|
"images/ci/Dockerfile": f"FROM ubuntu:24.04@{D1} AS os\nRUN pip install uv==0.13.5 \\\n && echo hi\nRUN echo x\n",
|
||||||
"images/molecule-ubuntu2404/Dockerfile": f"FROM ubuntu:24.04@{D1}\n",
|
"images/molecule-ubuntu2404/Dockerfile": f"FROM ubuntu:24.04@{D1}\n",
|
||||||
@@ -54,6 +55,7 @@ class RuleTest(unittest.TestCase):
|
|||||||
def test_allowed_edits(self):
|
def test_allowed_edits(self):
|
||||||
cases = [
|
cases = [
|
||||||
("requirements-dev.txt", "reuse==6.2.0", "reuse==6.3.0"),
|
("requirements-dev.txt", "reuse==6.2.0", "reuse==6.3.0"),
|
||||||
|
("requirements.yml", " version: 14.0.0", " version: 14.1.0"),
|
||||||
(".pre-commit-config.yaml", " rev: v1.0.0", " rev: v1.1.0"),
|
(".pre-commit-config.yaml", " rev: v1.0.0", " rev: v1.1.0"),
|
||||||
(
|
(
|
||||||
"images/ci/Dockerfile",
|
"images/ci/Dockerfile",
|
||||||
@@ -92,6 +94,17 @@ class RuleTest(unittest.TestCase):
|
|||||||
def test_refused_edits(self):
|
def test_refused_edits(self):
|
||||||
cases = [
|
cases = [
|
||||||
("requirements-dev.txt", "reuse==6.2.0", "evil==1.0"),
|
("requirements-dev.txt", "reuse==6.2.0", "evil==1.0"),
|
||||||
|
("requirements.yml", " version: 14.0.0", " version: '*'"),
|
||||||
|
(
|
||||||
|
"requirements.yml",
|
||||||
|
" version: 14.0.0",
|
||||||
|
" source: https://evil.example",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"requirements.yml",
|
||||||
|
" - name: community.general",
|
||||||
|
" - name: evil.collection",
|
||||||
|
),
|
||||||
("requirements-dev.txt", "reuse==6.2.0", "reuse @ https://x/y.tgz"),
|
("requirements-dev.txt", "reuse==6.2.0", "reuse @ https://x/y.tgz"),
|
||||||
(".pre-commit-config.yaml", " rev: v1.0.0", " repo: https://evil/x"),
|
(".pre-commit-config.yaml", " rev: v1.0.0", " repo: https://evil/x"),
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in new issue
Block a user