docs: prepare the repository for publication #70

Merged
Defame1297 merged 2 commits from chore/public-readiness into main 2026-11-08 18:17:58 +00:00
10 changed files with 77 additions and 109 deletions

No files matched your search

+2 -1
View File
@@ -1,7 +1,8 @@
name: Build
# Builds the Collection tarball and checks it. On a v* tag it also checks the release
# invariants of ADR 0004 (annotated tag, tag equals v + galaxy.yml version). Nothing is
# invariants of ADR 0004 (annotated tag, tag equals v + galaxy.yml version; the ADR is in the
# maintainer's environment repository). Nothing is
# uploaded: the tarball is built in a temporary directory and discarded. Releases are
# consumed by git tag, so there is no publish step. No org secret is used; the job token (secrets.GITHUB_TOKEN) clones the repository.
on: # yamllint disable-line rule:truthy
+1 -1
View File
@@ -1,7 +1,7 @@
name: Images
# Builds the images under images/ with kaniko (osscontainertools fork, v1.28.6) and
# pushes them to git.rkdr.net/mortis/<name> (ADR 0004, Image distribution): the molecule
# pushes them to git.rkdr.net/mortis/<name> (ADR 0004 in the maintainer's environment repository, Image distribution): the molecule
# test targets (molecule-ubuntu2404, molecule-ubuntu2604) and the lint/build tooling (ci).
#
# Never on pull_request: a workflow file comes from the PR head, so a fork PR could
+11 -6
View File
@@ -7,11 +7,16 @@ name: Molecule
# It runs on the `kamino-molecule` label, a host executor on kamino-runner, which uses
# that LXC's own Docker daemon; no job container is given the Docker socket. That makes
# the job root-equivalent on the runner LXC, which is rebuildable and holds no
# production secret (ADR 0004, Runner isolation). The runner's firewall is inert until
# the Proxmox datacenter firewall is enabled, so a scenario can reach the whole LAN:
# keep mortis/kamino private and accepting no fork pull requests until then. The `if:`
# guard is a convenience filter, not a boundary: the workflow file comes from the PR
# head. The real condition is that only trusted people can push branches here.
# production secret (ADR 0004 in the maintainer's environment repository, Runner
# isolation). The runner sits in an isolated network segment (outbound DNS to two
# resolvers and web traffic only; inbound SSH from two management hosts only), so a
# scenario cannot reach the LAN. A live test on 2026-11-08 showed a fork pull request's
# Build workflow starting on the runner at once, with no approval step (the tester may
# have had write access, so this is unproven for outsiders). The `if:` guard is a
# convenience filter, not a boundary: a fork controls its own workflow file. So the
# repository should not accept fork pull requests from untrusted users until the
# operator decides otherwise; the real condition is that only trusted people can push
# branches or open pull requests here.
#
# Tooling is provisioned on the runner by the gitea_runner role (molecule venv and the
# collections the roles use); this job installs nothing. The test image is pulled from
@@ -46,7 +51,7 @@ jobs:
# Same-repo branches only (bot branches included: a Renovate pin pull request is what tests a new
# image); a push to main or a manual dispatch always runs. No paths filter on pull requests, so
# that Molecule can be a required check: a required check that a pull request never starts would
# block it. A fork pull request is skipped (and the repository takes none).
# block it. A fork pull request is skipped by the guard below.
if: >-
github.repository == 'mortis/kamino' &&
(github.event_name != 'pull_request' ||
+33 -94
View File
@@ -5,14 +5,14 @@ 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
role from the author's homelab environment repository. The design contract is ADR 0004 (in the
maintainer's environment repository). 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.
Fork pull requests from untrusted users are not accepted for now: a fork controls its own
workflow file, so the `if:` guards are a convenience, not a boundary (see the header of
`molecule.yml`). Do not change visibility, repository settings, branch or tag protection,
or create tags: those are the operator's.
## Working here
@@ -66,8 +66,7 @@ protection, or create tags: those are the operator's.
digest.
- kaniko runs inside the job container and unpacks the image it builds over it, so each matrix entry names its
job container (`job_image: ubuntu:<release>@sha256:...`) and its release must equal the `FROM ubuntu:` release
of the image's Dockerfile (`check_image_versions.py pins` fails otherwise; run 2529 broke a 24.04 build in a
26.04 job container). Moving an image to a new release is one edit: the Dockerfile `FROM`, the `job_image`
of the image's Dockerfile (`check_image_versions.py pins` fails otherwise). Moving an image to a new release is one edit: the Dockerfile `FROM`, the `job_image`
tag and digest, and the version bump. Digest drift within a release is tolerated. A `job_image`-only bump is
not an image input: no version bump, nothing rebuilt; the post-merge Images run only reaches the prepare step
for published versions, so that is its only exercise.
@@ -80,93 +79,33 @@ protection, or create tags: those are the operator's.
new version. Editing a label in a Dockerfile is an input and does.
- Each pushed layer must stay below 100 MB: Cloudflare rejects larger request bodies with
HTTP 413. That is why the `ci` image deletes the Go toolchains from the hook cache.
- `image.yml` tries 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 secrets `PACKAGE_PUSH_USER` and
`PACKAGE_PUSH_TOKEN`. Never print or use them anywhere else.
- `image.yml` is the only workflow that may reference the org Actions secrets (the registry push credential). Never print or use them anywhere else.
## Dependency automation (Renovate)
`renovate.json` is run by `.gitea/workflows/renovate.yml` (see below). Items marked unverified have not run yet.
`renovate.json` is run by `.gitea/workflows/renovate.yml` (daily cron and `workflow_dispatch`) on the
`kamino-docker` runner, as a Kamino-only bot user, so code from this repository never runs in the
maintainer's production environment. Never reuse another Renovate credential here.
- **Policy:** minor and patch bumps automerge, majors are manual. An `ansible-core` minor can show new
sanity findings; the Build check is the gate (a red bump is not merged), and `ansible-core` and
`ansible-lint` bump in one group. Dockerfile base-image tag and digest bumps (`images/*/Dockerfile`)
stay automergeable within a release: Kamino is the untrusted side and the pin PR's CI exercises the new image.
A new Ubuntu release (major `ubuntu` update) is never a bump: it is a deliberate edit. The `job_image` of each
matrix entry in `image.yml` (the job container) never automerges: that job holds the registry push credential.
kaniko is pinned by layer digests in `image.yml`; no Renovate manager reads them, so it is updated by
hand (the `/kaniko/` rule in `renovate.json` is 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 image `version:` in
`image.yml` (`scripts/bump_image_versions.py [<base-ref>]`, idempotent, edits only the
version line; `check_image_versions.py bump` then passes). The merge builds the image on
`main`. PR 2 moves the consumers' `image:<version>@sha256:<digest>` pins to that digest.
`renovate.json` runs the script as a `postUpgradeTasks` command of a catch-all rule (matches every package, since
only the first upgrade of a branch counts; branch mode, file filter `image.yml`; allowed by the one anchored regex in `RENOVATE_ALLOWED_COMMANDS` of `renovate.yml`),
so PR 1 carries the bump. PR 2 is Renovate's too: the pin-follow rule for
`git.rkdr.net/mortis/*` moves the `image:<version>@sha256:<digest>` pins of `lint.yml`, `build.yml`
and `molecule.yml` to the newest published version and automerges after its own Lint and Build ran
in the new image (unverified until the first such PR; a major version stays manual).
- **Bot-diff gate:** the `lint` workflow runs `scripts/check_bot_pr_diff.py` on pull requests. A
head ref starting `renovate/` may only change version lines in `requirements-dev.txt`, `rev:`
lines in `.pre-commit-config.yaml`, FROM tags/digests and the `uv==` pin in `images/*/Dockerfile`,
the matrix `version:` lines and the `job_image:` ubuntu pins in `image.yml`, and the image
pins in `lint.yml`, `build.yml` and `molecule.yml`. Anything else fails, `renovate.json` included.
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.yml`
`build_ignore`, so the Collection archive and version do not change. A role-visible change needs
a changelog fragment and a new `galaxy.yml` version, and only the operator tags.
- **No production images:** `check_image_versions.py pins` fails when anything under
`.gitea/workflows` mentions `git.rkdr.net/defame1297/`.
- **Where Renovate runs:** `.gitea/workflows/renovate.yml`, a daily cron (03:17 UTC) plus
`workflow_dispatch`, on the `kamino-runner` (`kamino-docker`): the untrusted side, so code from this
repository never runs in the production cluster (ADR 0004). It authenticates as a Kamino-only bot user
(write access to this repository only, no admin, no other repository) whose token is the repository
secret `RENOVATE_BOT_TOKEN` (scopes `write:repository`, `write:issue`, `read:user`, `read:organization`; not an org secret:
only `image.yml` may reference those). `read:organization` is needed because Renovate reads the owner organisation when it initialises the repository (dry run 2450: 403 without it). Never reuse the in-cluster Renovate user's token here: it
reaches the production repository. The workflow's own job token does not work: Renovate filters
its pull request lookups by its own username, which is the virtual user `gitea-actions`, and Gitea
answers `400 user does not exist` (dry run 2445). The bot user must not be able to push to `main`
or merge past the required checks (branch protection). The job container is `renovate/renovate:<version>-full@sha256:...` from Docker Hub
(the `-full` flavour for `python3`), same version as the cluster's CronJob, hand-bumped (renovate.json
disables updates for the workflow file). Lookups of the github.com pre-commit hooks are
unauthenticated (no `RENOVATE_GITHUB_COM_TOKEN` exists) and may hit rate limits: best effort.
- **Dry run:** Actions > Renovate > Run workflow with `dry_run=true` (the default for a manual run;
sets `RENOVATE_DRY_RUN=full`, `LOG_LEVEL=debug`). Read the debug log: no branch or PR is created. The
schedule runs live. The job fails (it used to stay green) when Renovate exits non-zero
(`RENOVATE_EXIT_CODE_FOR_ERRORS`, 7 for a failed clone) or when the JSON report
(`RENOVATE_REPORT_TYPE=file`) is missing or holds an ERROR or FATAL problem; warnings do not fail it.
A first good dry run shows a clone (no `external-host-error`, no `could not read Username`).
- **Open item: the first live run (do not enable automerge for bot PRs until one has shown it gets Lint and
Build).** The dry run proves the READS (lookups, config, branch plan) and, from the Renovate 44.161.0
source (confirm by the log line for the post-upgrade task), also runs `postUpgradeTasks`. Dry run 2445
already showed that git over HTTPS works with the global `http.<server>/.extraheader`
(`AUTHORIZATION: bearer <token>`, like `lint.yml`; Renovate does not pass `GIT_CONFIG_*` from its
environment to git but does pass `HOME`), which fixed the redirect failure of run 2439. Still unproven
until a run with the bot token: (1) that the bearer header is accepted for a personal access token (if
not, use basic auth with the bot user name); (2) that the first LIVE run can push a branch and open a
PR; (3) that PRs opened by the bot user trigger the PR workflows (it is a normal user, so they should; if
the required `Lint` and `Build` never start, automerge cannot work); (4) that bot PRs are held by
`main`'s required status checks (check the branch protection). Also confirm in the log: Renovate clones
blobless with full history, so `origin/main` exists for the script (source-based); `python3` is in the
image (no PyYAML: the scripts the bump step imports use the standard library only, dry run 2453); `github.head_ref` is populated (the gate fails closed on an empty one, via `EVENT_NAME`). Safety
net: a failing or disallowed post-upgrade command opens the PR WITHOUT the bump plus a red
`renovate/artifacts` status, and `check_image_versions.py bump` then fails lint. The job itself stays green:
the JSON report only records `branchName`, `prNo`, `prTitle`, `result` and `upgrades` per branch (run 2597),
with no field for a failed post-upgrade task, so the report check cannot see it.
- **The workflow holds the runner's slot:** the `kamino-runner` host has a single slot (the label is
`kamino-docker`), and the Renovate job may run up to 30 minutes (`timeout-minutes`) from 03:17 UTC, so
Lint, Build and Molecule checks queue behind it.
- **Not enabled:** credentials for the `git.rkdr.net` registry (`hostRules`; the tag and digest lookups
are anonymous). The `pre-commit` manager is beta.
- **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 extracts `scripts/` from `origin/main` and runs the
guard from there, so a pull request cannot weaken its own gate (the PR copy runs only while `main`
has 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 any
`image.yml` push path (`images/**`, `requirements-dev.txt`, `.pre-commit-config.yaml`,
`.gitea/workflows/image.yml`), so it rebuilds nothing.
- **Policy:** minor and patch bumps automerge, majors are manual; the Lint and Build checks are the gate.
A new Ubuntu release is a deliberate edit, never a bump. The `job_image` of each matrix entry in `image.yml`
never automerges: that job holds the registry push credential. kaniko is pinned by layer digests in
`image.yml` and updated by hand.
- **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 image `version:` in `image.yml`
(`scripts/bump_image_versions.py [<base-ref>]`; `check_image_versions.py bump` then passes; Renovate runs it
as a post-upgrade task). The merge builds the image on `main`. PR 2 moves the consumers' pins to the new
digest (Renovate's pin-follow rule for the `mortis/*` images; a major version stays manual).
- **Bot-diff gate:** `scripts/check_bot_pr_diff.py` runs in the lint workflow, from `origin/main`'s copy so a
pull request cannot weaken it. A `renovate/` head ref may only change version lines (tool pins, hook `rev:`
lines, Dockerfile FROM tags and digests, matrix `version:` lines, `job_image:` pins, consumer image pins);
anything else fails, `renovate.json` included. The branch name is attacker-controlled, so this only
constrains the bot's own pull requests.
- **No Collection release from tooling bumps:** tooling files are in `galaxy.yml` `build_ignore`. A
role-visible change needs a changelog fragment and a new `galaxy.yml` version; only the operator tags.
- **No production images:** `check_image_versions.py pins` fails when anything under `.gitea/workflows`
mentions the maintainer's production image namespace.
- **Hand edits on a bot branch:** a commit pushed by hand to a `renovate/` branch makes Renovate stop
rebasing it, so merge that pull request by hand.
- **The runner has a single slot:** the Renovate job (up to 30 minutes) delays Lint, Build and Molecule.
- **Open item:** do not enable automerge for bot PRs until a live run has shown that they get Lint and Build.
+4 -4
View File
@@ -1,9 +1,9 @@
# Contributing
- Open a pull request against `main`. A first-time contributor's fork pull
request needs a maintainer's approval before workflows run (Gitea waives this
once you have a merged pull request). Workflows on fork pull requests get no
secrets and a read-only token.
- Open a pull request against `main`. Fork pull requests from untrusted users
are not accepted for now: a fork controls its own workflow file, and a test
showed workflows starting without an approval step. Workflows on fork pull
requests get no secrets and a read-only token.
- Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
(`feat:`, `fix:`, `docs:`, `ci:` ...). CI checks every commit.
- Every user-visible change needs a changelog fragment in `changelogs/fragments/`
+20
View File
@@ -0,0 +1,20 @@
# Security policy
## Reporting a vulnerability
Please report a suspected vulnerability privately. Do not open a public issue or pull
request for it.
TODO(operator): fill in the private reporting contact (for example a security mailbox or
the forge's private vulnerability reporting) before this repository is made public. Until
this line is replaced, there is no published channel.
A report should say which role, script or workflow is affected, how to reproduce the
problem and what impact you expect. The maintainer will acknowledge the report and
coordinate a fix and its disclosure with you.
## Scope
This repository holds Ansible roles, CI workflows and the container images they use. Roles
change the hosts they run against, so a flaw that weakens a hardening default or leaks a
secret is in scope. Only the latest release is supported.
+1 -1
View File
@@ -27,7 +27,7 @@ It has no Node, so JavaScript actions (`actions/checkout`) cannot run in it: clo
As the job container of a workflow on the `kamino-docker` runner, pinned by tag and digest. This is the
shape of `.gitea/workflows/lint.yml` (which also holds the checkout step with the job-token authentication the
private repository needs; read it for the full version):
repository needs; read it for the full version):
```yaml
jobs:
+1
View File
@@ -34,6 +34,7 @@ build_ignore:
- .ansible-lint
- CLAUDE.md
- CONTRIBUTING.md
- SECURITY.md
- HANDOFF.md
- extensions
- images
+2 -1
View File
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: Defame1297 and contributors
# SPDX-License-Identifier: GPL-3.0-or-later
"""Bump the PATCH version of every image whose inputs changed (ADR 0004, Image distribution).
"""Bump the PATCH version of every image whose inputs changed (ADR 0004, Image distribution, in the
maintainer's environment repository).
python3 scripts/bump_image_versions.py [<base-ref>] (default: origin/main)
+2 -1
View File
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: Defame1297 and contributors
# SPDX-License-Identifier: GPL-3.0-or-later
"""Keep image versions and image pins honest (ADR 0004, Image distribution).
"""Keep image versions and image pins honest (ADR 0004, Image distribution, in the
maintainer's environment repository).
python3 scripts/check_image_versions.py pins
python3 scripts/check_image_versions.py bump <base-ref>