Remove the image-input packageRule that set no option. Add a dockerfile rule that states, and pins, that base-image tag and digest bumps may automerge (Kamino is the untrusted side, the pin PR's CI exercises the image); the ubuntu job container stays at automerge false. Say kaniko is pinned by layer digests that no manager reads and is updated by hand. List what is not enabled or verified (GITHUB_COM_TOKEN for the pre-commit manager, main's required checks, github.head_ref) and that a hand edit on a renovate/ branch stops Renovate's rebases. renovate-config-validator --strict (renovate 44.161.0) passes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
7.9 KiB
CLAUDE.md
Guidance for Claude Code (claude.ai/code) in this repository.
What this is
mortis.kamino: an Ansible Collection (GPL-3.0-or-later, REUSE-compliant), extracted role by
role from the author's homelab Environment repo (Defame1297/ansible-homelab-mono). The
design contract is ADR 0004 in that repo (docs/adr/0004-collection-consumption-and-release.md)
and the tracking issue is its epic #486. There are no roles here yet: wave 1 arrives with the
extraction.
The repo is private and takes no fork pull requests until the author has verified the isolation of its CI runner. Do not change visibility, repository settings, branch or tag protection, or create tags: those are the operator's.
Working here
- Set up once per clone:
scripts/dev-setup.sh(a virtualenv with the pinned tools and git hooks that find them). Thelanguage: systemhooks runreuse,ansible-lintandantsibull-changelogby name, so a hook run without that virtualenv onPATHfails. - Commit with git in a clone, never through the Gitea API. The hooks (REUSE, yamllint,
actionlint, ansible-lint, gitleaks, changelog lint, Conventional Commits) only run in
git commit; an API commit skips them and CI finds the problem after the push. The first hook run builds the Go hook environments and takes minutes: run commits in the background. - Feature branch and pull request;
mainandv*tags are protected. Never push tomain. Releases are the operator's: annotatedvX.Y.Ztags equal togalaxy.yml's version. - Conventional Commits. A PR says what was verified and what was not.
- There is no local molecule and no container runtime on the control host: do not install one.
Molecule runs in CI, on the repository's own runner (label
kamino-molecule). - Changes that can affect a consumer need a changelog fragment (
changelogs/fragments/). New files are covered byREUSE.toml; third-party-derived content needs its own annotation.
Workflows (.gitea/workflows/)
- Never
pull_request_target. A forkpull_requestrun gets no secrets and a read-only job token; a same-repo pull request does get the org Actions secrets, so nothing butimage.ymlmay reference them. Pass ref, repo and name values to scripts throughenv:, never interpolate${{ github.* }}into arun:block. - Runner labels are
kamino-dockerandkamino-moleculeonly (.gitea/actionlint.yaml). Use thegithub.*contexts, which Gitea aliases; actionlint does not knowgitea.*. - Lint and Build run in the
ciimage. After the checkout they compare the pin files with the checksums baked into the image: a PR that changesrequirements-dev.txtor.pre-commit-config.yamltakes the slower path that installs the pinned tools. - Molecule discovers
extensions/molecule/*/androles/*/molecule/*/. Theimage-smokescenario tests the molecule image itself.
Images (images/)
ciandmolecule-ubuntu2404, built byimage.ymlwith kaniko on push tomain(never on pull requests) and pushed togit.rkdr.net/mortis/<name>.- Each has a semver
version:in the workflow's build matrix. A published version tag is never moved (the job looks it up in the registry first): bump the version in the PR that changes the image. - Consumers pin
image:<version>@sha256:<digest>(lint.yml,build.yml,molecule.yml). A build prints the new digest; moving a pin is a reviewed edit, and every build has a new digest. - Each pushed layer must stay below 100 MB: Cloudflare rejects larger request bodies with
HTTP 413. That is why the
ciimage deletes the Go toolchains from the hook cache. image.ymltries the job token first with a write probe; Gitea 28 refuses it for the org's packages (HTTP 401, run 2237), so the push uses the org Actions secretsPACKAGE_PUSH_USERandPACKAGE_PUSH_TOKEN. Never print or use them anywhere else.
Dependency automation (Renovate, Phase 0: configured, not active)
renovate.json is inert until the operator adds Kamino to the self-hosted instance's repository
list. Nothing below runs yet unless it says so.
- Policy: minor and patch bumps automerge, majors are manual.
ansible-coreminor and major are manual too (a new minor needs atests/sanity/ignore-2.NN.txt), andansible-coreandansible-lintbump in one group. Dockerfile base-image tag and digest bumps (images/*/Dockerfile) stay automergeable: Kamino is the untrusted side and the pin PR's CI exercises the new image. Theubuntujob container ofimage.ymlnever automerges: that job holds the registry push credential. kaniko is pinned by layer digests inimage.yml; no Renovate manager reads them, so it is updated by hand (the/kaniko/rule inrenovate.jsonis only a safety net). - Two-PR loop for an image input (
requirements-dev.txt,.pre-commit-config.yaml,images/**): PR 1 carries the input change plus the PATCH bump of the imageversion:inimage.yml(scripts/bump_image_versions.py [<base-ref>], idempotent, edits only the version line;check_image_versions.py bumpthen passes). The merge builds the image onmain. PR 2 moves the consumers'image:<version>@sha256:<digest>pins to that digest. Until Phase 2/3 enables the script as apostUpgradeTaskscommand (the cluster allows no commands yet, andrenovate.jsonmust not list any), the bump in PR 1 is a hand edit, and PR 2 stays a hand edit until Phase 4 (pin-follow forgit.rkdr.net/mortis/*isenabled: false; it needs a dry run against the registry first). - Bot-diff gate: the
lintworkflow runsscripts/check_bot_pr_diff.pyon pull requests. A head ref startingrenovate/may only change version lines inrequirements-dev.txt,rev:lines in.pre-commit-config.yaml, FROM tags/digests and theuv==pin inimages/*/Dockerfile, the matrixversion:lines and the ubuntu job container pin inimage.yml, and the image pins inlint.yml,build.ymlandmolecule.yml. Anything else fails,renovate.jsonincluded. Tags are[A-Za-z0-9._-]only, FROM and ubuntu lines must keep their digest, matrix versions must stay in place and rise, and a binary or one-sided change fails. The branch name is attacker-controlled, so this only constrains the bot's own pull requests; its purpose is that automerging them cannot alter workflow logic or reach the org secrets. - No Collection release from tooling bumps: everything involved is in
galaxy.ymlbuild_ignore, so the Collection archive and version do not change. A role-visible change needs a changelog fragment and a newgalaxy.ymlversion, and only the operator tags. - No production images:
check_image_versions.py pinsfails when anything under.gitea/workflowsmentionsgit.rkdr.net/defame1297/. - Not enabled yet: the Renovate run itself,
postUpgradeTasks, credentials for thegit.rkdr.netregistry (hostRules), pin-follow, and a validatedrenovate.jsonon the instance's Renovate version. Thepre-commitmanager is beta; the hooks come from github.com, so it needsGITHUB_COM_TOKENon the Renovate instance. Unverified: that bot PRs are held bymain's required status checks (check the branch protection before enabling automerge), and thatgithub.head_refis populated on this Gitea (the gate fails closed on an empty one, viaEVENT_NAME). - Hand edits on a bot branch: a commit pushed by hand to a
renovate/branch makes Renovate treat the branch as modified: it stops rebasing it, so merge that pull request by hand. - The guard runs from
main: the lint step extractsscripts/fromorigin/mainand runs the guard from there, so a pull request cannot weaken its own gate (the PR copy runs only whilemainhas no guard). A change to the guard takes effect for other PRs after it merges. - A pin-only pull request (only
lint.yml,build.yml,molecule.yml) does not match anyimage.ymlpush path (images/**,requirements-dev.txt,.pre-commit-config.yaml,.gitea/workflows/image.yml), so it rebuilds nothing.