ci(deps): pin hook revisions by SHA and install dev tools from a hashed lock
Build / build (pull_request) Successful in 10s
Lint / lint (pull_request) Successful in 1m42s
Molecule / molecule (pull_request) Successful in 5m23s

Refs #113.

- .pre-commit-config.yaml: every hook repo is pinned by commit SHA with the release in a
  `# frozen:` comment, so a moved tag cannot change the code a hook environment is built from.
- requirements-dev.lock: hashed lock of requirements-dev.txt. Installs use
  `pip install --require-hashes -r requirements-dev.lock -r requirements-dev.txt` (dev-setup.sh,
  the ci image, the fallback install of Lint and Build): pip refuses an unhashed package and any
  disagreement between the two files.
- scripts/lock-requirements.sh regenerates the lock (pinned pip and pip-tools, --upgrade mode).
- renovate.json: the pip-compile manager replaces pip_requirements for the lock, plus a weekly,
  never automerged lock-file maintenance PR for transitive packages. Not yet dry-run on Renovate.
- check_bot_pr_diff.py accepts `rev: <sha>  # frozen: <tag>` and lock entries, hashes and plain
  comments, but not a changed pip-compile header command.
- ci image 0.2.18 -> 0.2.19 (image inputs changed).
This commit is contained in:
Dragonish committed 2026-11-14 16:52:38 +00:00
1 parent 7fa6c6754d
commit 4058978353
20 files changed
+1546 -46

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Sets up a local checkout for development: a virtualenv with the pinned tools
# (requirements-dev.txt, the versions CI runs), the pinned collections the roles call
# (requirements-dev.lock, the hashed lock of requirements-dev.txt: the versions CI runs), the pinned collections the roles call
# (requirements.yml) and git hooks that find the tools.
#
# scripts/dev-setup.sh # KAMINO_PYTHON=python3.13 scripts/dev-setup.sh to pick one
@@ -21,7 +21,7 @@
# of requirements.yml into .ansible/collections of this clone: scripts/ansible-lint.sh (the
# ansible-lint hook) resolves modules from there, so local lint sees the collection versions CI
# does (the ci image bakes requirements.yml) and not the control host's ~/.ansible. It is
# idempotent; run it again after changing requirements-dev.txt, requirements.yml or the hook types.
# idempotent; run it again after changing requirements-dev.txt or its lock, requirements.yml or the hook types.
set -euo pipefail
# ansible-core 2.22 (requirements-dev.txt) needs Python 3.13+. Renovate raises that pin, so
@@ -120,7 +120,7 @@ if [ -x .venv/bin/python ] && ! .venv/bin/python -c "$py_ok" 2>/dev/null; then
rm -rf "$root/.venv"
fi
[ -x .venv/bin/python ] || "$python" -m venv .venv
.venv/bin/pip install --quiet --disable-pip-version-check -r requirements-dev.txt
.venv/bin/pip install --quiet --disable-pip-version-check --require-hashes -r requirements-dev.lock -r requirements-dev.txt
.venv/bin/pre-commit install --install-hooks
# The collections of requirements.yml, exactly as pinned, into this clone (.ansible/ is ignored by