fix(ci): tighten the Collection archive check and make its guards testable
Build / build (pull_request) Successful in 9s
Lint / lint (pull_request) Successful in 8s
Molecule / molecule (pull_request) Successful in 29s

The forbidden names widen to anything containing "vault", SSH keys, .envrc and
.env* files. Names that Windows or macOS extraction would read differently are
rejected (trailing space or dot, reserved device names, "::", 8.3 aliases of
.git, non-ASCII spaces, surrogate/private-use/unassigned characters, components
over 255 bytes), and the .git test compares after NFKC and case folding.
Duplicates are compared case-insensitively, a name that is both a file and a
directory is rejected, and only one slash is stripped. A unit test builds a real
tarball with ansible-galaxy, another asserts the directories build.yml prunes are
in galaxy.yml build_ignore, lint.yml runs tests/scripts, and the Build workflow
fails unless exactly one tarball matches. The docstring states that file
symlinks are invisible to the archive check.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
Defame1297andClaude Sonnet 5.5 committed 2026-10-25 19:57:40 +00:00
1 parent b5751e14d6
commit cab2187c89
5 files changed
+215 -20

No files matched your search

+17 -3
View File
@@ -85,7 +85,11 @@ jobs:
# ansible-galaxy dereferences symlinks when it builds, so a symlink in the source tree
# reaches the archive as a regular file with the target's content, where
# scripts/check_tarball.py cannot see it. Refuse them in the tree instead.
# scripts/check_tarball.py cannot see it. Refuse them in the tree instead: this step
# is the only guard against a file symlink. The two -prune paths below (./.venv,
# ./.git) are skipped only because the build skips them too (galaxy.yml build_ignore,
# and ansible-galaxy's own .git exclusion): the two lists must stay in step, and
# tests/scripts/test_check_tarball.py fails when a pruned directory is not ignored.
- name: Refuse symlinks in the source tree
run: |
links="$(find . -path ./.git -prune -o -path ./.venv -prune -o -type l -print)"
@@ -107,7 +111,12 @@ jobs:
- name: Check the archive contents
run: |
export PATH="/opt/venv/bin:$PATH"
python3 scripts/check_tarball.py /tmp/dist/mortis-kamino-*.tar.gz
set -- /tmp/dist/mortis-kamino-*.tar.gz
if [ "$#" -ne 1 ] || [ ! -f "$1" ]; then
echo "::error::expected exactly one tarball in /tmp/dist, found $# match(es): $*"
exit 1
fi
python3 scripts/check_tarball.py "$1"
# galaxy-importer without ansible-test and without Docker (ADR 0004, Collection
# repo gates). The importer reads its configuration from this file.
@@ -120,8 +129,13 @@ jobs:
RUN_ANSIBLE_LINT = False
LOCAL_IMAGE_DOCKER = False
CFG
set -- /tmp/dist/mortis-kamino-*.tar.gz
if [ "$#" -ne 1 ] || [ ! -f "$1" ]; then
echo "::error::expected exactly one tarball in /tmp/dist, found $# match(es): $*"
exit 1
fi
GALAXY_IMPORTER_CONFIG=/tmp/galaxy-importer.cfg \
python3 -m galaxy_importer.main /tmp/dist/mortis-kamino-*.tar.gz
python3 -m galaxy_importer.main "$1"
# Sanity tests need the collection at ansible_collections/<namespace>/<name>.
- name: Run ansible-test sanity