ci: lint scripts with ruff and shellcheck, bake pinned collections into the ci image #121

Merged
Defame1297 merged 11 commits from ci/ruff-shellcheck-and-baked-collections into main 2026-11-14 14:45:23 +00:00
3 changed files with 26 additions and 0 deletions
Showing only changes of commit 87b23ea4f3 - Show all commits

No files matched your search

+6
View File
@@ -11,6 +11,7 @@
"semanticCommitScope": "deps",
"enabledManagers": [
"pip_requirements",
"ansible-galaxy",
"pre-commit",
"github-actions",
"dockerfile",
@@ -26,6 +27,11 @@
"/^requirements-dev\\.txt$/"
]
},
"ansible-galaxy": {
"managerFilePatterns": [
"/^requirements\\.yml$/"
]
},
"pre-commit": {
"enabled": true,
"managerFilePatterns": [
+7
View File
@@ -7,6 +7,7 @@
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.yml: `version:` lines (the collection names, and every other line, stay);
* .pre-commit-config.yaml: `rev:` lines;
* 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;
@@ -93,6 +94,10 @@ def reduce_requirement(line):
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):
return "rev" if REV_LINE.match(line) else None
@@ -127,6 +132,8 @@ def file_problem(path, removed, added):
reduce_requirement,
"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":
return same_shape(removed, added, reduce_rev, "a `rev:` line")
if DOCKERFILE.fullmatch(path):
+13
View File
@@ -17,6 +17,7 @@ import check_bot_pr_diff as cbd
D1, D2 = "sha256:" + "a" * 64, "sha256:" + "b" * 64
FILES = {
"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",
"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",
@@ -54,6 +55,7 @@ class RuleTest(unittest.TestCase):
def test_allowed_edits(self):
cases = [
("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"),
(
"images/ci/Dockerfile",
@@ -92,6 +94,17 @@ class RuleTest(unittest.TestCase):
def test_refused_edits(self):
cases = [
("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"),
(".pre-commit-config.yaml", " rev: v1.0.0", " repo: https://evil/x"),
(