fix(setup): leave a shared absolute VENV in place #51
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/castrum!51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/setup-shared-venv"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
make setupbuilds the Python toolchain castrum's gates and playbooksrun from (ansible-core, ansible-lint, molecule, the collections), and
contributors and coding agents run it to prepare every new checkout or
worktree. A container image can instead bake that toolchain once,
outside any checkout, and export
VENVwith its path, so that everycheckout in the container shares it, as
CONTRIBUTING.md§ Setupdescribes.
In such a container,
make setupremoved the shared toolchain beforerebuilding it from the network. Every other checkout of the container
lost its tools until the rebuild finished, and for good when it failed,
such as offline; agents ran it for each worktree they opened. Under
Claude Code's sandbox, which keeps the path read-only, setup failed
with exit 2 instead, which is how it showed up.
Two alternatives were set aside: refusing every absolute
VENV, whichwould stop
make VENV=/some/path setupfrom building a toolchainoutside the checkout as it does today; and telling agents to skip
setup there, which this change makes unnecessary, since setup is now
safe there.
What changed
Before,
make setupwith an absoluteVENValways ranrm -rf $(VENV)and rebuilt it. Now, when thatVENValready holds anexecutable
bin/ansible-lint, the same testmake checkmakes, setupleaves it in place, clears only the checkout's
.ansiblecaches, andsays so:
setup: using the shared toolchain in <VENV>, left in place.A relative
VENV, such as the default.venv, and an absoluteVENVwithout that executable are removed and rebuilt as before.
The test is a Make conditional in the
Makefile'ssetuptarget. Thenew gate
tests/gates/check_setup_shared_venv.sh, run bymake check,checks setup's commands with
make -n, its first commit pinning therebuild that stays.
CONTRIBUTING.md§ Setup and § Gates describe both.How to verify
Have Git, GNU Make and Python 3.12 or later; nothing is installed, and
the stub stands in for a shared toolchain.
On
main, setup would remove the shared toolchain:Then on the branch, for real:
make setupexits 0 and the stub is still there.Checks:
make checkpassed on every commit of the branch and on thetip; the gate's shared-toolchain check fails on
mainat"setup removes the shared toolchain", and its pins pass there.
make VENV=.venv setupstill builds a checkout venv from scratch.Not tried:
make test, since podman was missing where the change wasmade; the change touches no role or scenario.
Considerations
make setup:rebuilding it means removing it or rebuilding the image, as
CONTRIBUTING.mdnow says.make -noutput, so it sees only conditions Makedecides; moving the test into the recipe's shell would need the gate
revised.