ci(hooks): run ansible-test sanity before a push
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 30s
Molecule / molecule (pull_request) Successful in 5m22s

Add a pre-push hook that runs scripts/ansible-test-sanity.sh, so the Build job's sanity check, which ruff and the other hooks do not cover (it failed on a name only its pylint disallows), stops a push instead of the pull request. It is pre-push and not pre-commit because a cold run builds virtualenvs and needs the network; CI's pre-commit run does not run that stage, and a local system hook builds no environment. pre-push joins default_install_hook_types, and dev-setup.sh and its test treat it like the other two hook types, so its hook script also gets the virtualenv on PATH.

Verified through git push --dry-run in a throwaway clone: a commit with a disallowed name inside a function is blocked (exit 1, the same pylint message as CI, failed to push), and the push passes once it is removed.

Image input: .pre-commit-config.yaml is baked into the ci image, so ci 0.2.17 -> 0.2.18 (scripts/bump_image_versions.py). The new hook adds no hook environment and no layer size; the merge builds 0.2.18 and a pin PR follows.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
This commit is contained in:
Defame1297andClaude Sonnet 5.5 committed 2026-11-14 15:52:35 +00:00
1 parent 574c0d00f9
commit 18a7e26e4f
6 files changed
+24 -6

No files matched your search

+1 -1
View File
@@ -133,7 +133,7 @@ ANSIBLE_COLLECTIONS_PATH="$collections" .venv/bin/ansible-galaxy collection inst
marker="# kamino-dev-setup: virtualenv first on PATH"
# default_install_hook_types in .pre-commit-config.yaml names these; keep in step.
for hook in pre-commit commit-msg; do
for hook in pre-commit commit-msg pre-push; do
file="$(git -C "$root" rev-parse --path-format=absolute --git-path "hooks/$hook")"
if [ ! -f "$file" ]; then
echo "error: $file was not installed by 'pre-commit install'; check default_install_hook_types in .pre-commit-config.yaml." >&2