docs: remove references to anything outside this repository #273

Merged
Defame1297 merged 1 commits from docs/stand-alone-references into main 2026-11-20 23:14:54 +00:00
19 changed files with 83 additions and 71 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
---
# Same profile as the environment repo. The production profile enforces
# The production profile is ansible-lint's strictest. It enforces
# var-naming[no-role-prefix]: every role variable carries the role name as a prefix.
profile: production
+3 -3
View File
@@ -1,7 +1,7 @@
# Runner labels used by the workflows, so actionlint accepts them. These belong
# to the Collection's own runner (scoped to the mortis org); the production
# labels (docker, ubuntu-lxc, molecule) are deliberately not listed, so a
# workflow that names one fails actionlint.
# to the Collection's own runner (scoped to the mortis org). No other label is
# listed, so a workflow that names one fails actionlint: this repository's jobs
# run only on its own runners.
self-hosted-runner:
labels:
- kamino-docker
+3 -3
View File
@@ -31,7 +31,7 @@ name: Images
# - Layers: every layer stays far below Cloudflare's 100 MB request-body limit (see the
# Dockerfile). No kaniko cache: a tiny, rarely rebuilt image gains little, and cache
# layers would be pushed through the same Cloudflare-limited path.
# - Memory: the runner LXC has 3 GB and capacity 1; the job container is capped at 2 GB.
# - Memory: the job container is capped at 2 GB, so a runaway build cannot exhaust the runner.
on: # yamllint disable-line rule:truthy
push:
branches:
@@ -88,13 +88,13 @@ jobs:
dockerfile: Dockerfile
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
- name: ci
version: 0.2.29
version: 0.2.30
subpath: ""
dockerfile: images/ci/Dockerfile
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
container:
image: ${{ matrix.job_image }}
# Keeps a runaway build from taking the whole 3 GB runner LXC down with it.
# Keeps a runaway build from taking the whole runner down with it.
options: --memory=2g --memory-swap=2g
env:
DEBIAN_FRONTEND: noninteractive
+3 -3
View File
@@ -1,7 +1,7 @@
name: Lint
# Runs on the Collection's own runner (label kamino-docker, scoped to the mortis org),
# never on the production runner. No org secret is used: the only credential is the
# Runs only on the Collection's own runner (label kamino-docker, scoped to the mortis org).
# No org secret is used: the only credential is the
# job token (secrets.GITHUB_TOKEN), which is read-only for a fork pull request. No pull_request_target.
# The tools come from the ci image (images/ci, built by image.yml): the pinned Python
# tools of requirements-dev.txt, the collections of requirements.yml and the hook
@@ -44,7 +44,7 @@ jobs:
ANSIBLE_COLLECTIONS_PATH: /opt/collections
steps:
# The container has no Node, so JavaScript actions such as actions/checkout
# cannot run; clone with git and the job token, as the environment repo does.
# cannot run; clone with git and the job token.
- name: Checkout the commit under test
env:
GIT_CONFIG_COUNT: "1"
+13 -19
View File
@@ -4,21 +4,15 @@ name: Molecule
# extensions/molecule/*/ and roles/*/molecule/*/. extensions/molecule/image-smoke and
# image-smoke-2604 test the test images themselves, so they run even before any role exists.
#
# 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 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.
# It runs on the `kamino-molecule` label, a host executor that uses the runner's own
# Docker daemon; no job container is given the Docker socket. That makes the job
# root-equivalent on the runner, which is disposable and holds no secret from outside
# this repository (ADR 0004 in the maintainer's environment repository, Runner
# isolation). The `if:` guard is a convenience filter, not a boundary: a fork controls its
# own workflow file. So the repository does not accept fork pull requests; the real
# condition is that only trusted people can push branches or open pull requests here.
#
# The molecule venv is provisioned on the runner by the gitea_runner role. The collections
# The molecule venv is provisioned on the runner, not by this workflow. The collections
# the roles use are this repository's own pins (requirements.yml, the file the ci image bakes
# for Lint), and the driver's own collection is pinned in extensions/molecule/requirements.yml:
# the job installs both, cached on the runner by their checksum. The test image is pulled from
@@ -53,8 +47,8 @@ permissions:
# same rule as lint.yml and build.yml); a run on main is never cancelled, so its group is the
# commit SHA. Scenarios use fixed container names on the runner's shared Docker daemon, so two
# runs must not overlap. The group no longer guarantees that (it is per pull request now): the
# runner's single slot does (gitea_runner_capacity: 1 in the maintainer's environment
# repository). Raise that capacity and this needs a lock or a shared group again.
# runner's single slot does. Raise the runner's capacity and this needs a lock or a shared
# group again.
concurrency:
group: molecule-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
@@ -82,12 +76,12 @@ jobs:
MOLECULE_IMAGE_2604: >-
git.rkdr.net/mortis/molecule-ubuntu2604:0.1.5@sha256:4ba40ee3603a33778254f22bc0f9360b9f7dd0ed5c03c5b2f935186c7b84dd6f
steps:
# The molecule venv is provisioned by the gitea_runner role (install_services); fail with
# a clear message when this runs before it has.
# The molecule venv is provisioned on the runner, not by this job; fail with a clear
# message when it is missing.
- name: Check the provisioned tooling
run: |
if ! test -x "$MOLECULE_VENV/bin/molecule"; then
echo "::error::molecule is not installed on this runner: run install_services for kamino-runner first"
echo "::error::molecule is not installed on this runner: provision its molecule venv first"
exit 1
fi
docker version --format '{{.Server.Version}}' || { echo "::error::the Docker daemon is not reachable by the runner user"; exit 1; }
+5 -5
View File
@@ -1,8 +1,8 @@
name: Renovate
# Dependency updates for this repository (renovate.json). Runs on the Collection's own runner
# (label kamino-docker, the untrusted side), never in the production cluster: code from this
# repository must not run there. The credential is the token of a Kamino-only bot user, held as
# Dependency updates for this repository (renovate.json). Runs only on the Collection's own runner
# (label kamino-docker), and no credential from anywhere else is used here.
# The credential is the token of a Kamino-only bot user, held as
# the repository secret RENOVATE_BOT_TOKEN (not an org secret: only image.yml may reference those).
# The job token cannot be used: Renovate filters every pull request lookup by its own username,
# which is the virtual user gitea-actions with the job token, and Gitea answers 400 "user does not
@@ -43,8 +43,8 @@ jobs:
if: github.repository == 'mortis/kamino' || github.repository == 'Mortis/Kamino'
runs-on: kamino-docker
timeout-minutes: 30
# Docker Hub image, pinned by digest like the cluster's CronJob (same version). The -full
# flavour ships python3 for the postUpgradeTasks command. Hand-bumped: renovate.json
# Docker Hub image, pinned by digest. The -full flavour ships python3 for the
# postUpgradeTasks command. Hand-bumped: renovate.json
# disables updates for this file. The image sets RENOVATE_BINARY_SOURCE=global, so pip-compile
# runs on the image's own python (3.14.8 in 44.161.0) and ignores the Python that Renovate
# reads from the lock header: that python's minor version must equal .python-version, or a lock
+1 -1
View File
@@ -13,7 +13,7 @@ vault-pass*
gitleaks-report.json
# galaxy-importer output
importer_result.json
# APM (holocron skills): apm_modules/ is the dependency cache; .claude/skills,
# APM: apm_modules/ is the dependency cache; .claude/skills,
# agents and hooks are `apm install` deploy output, regenerated on every install.
apm_modules/
.claude/skills/
+2 -2
View File
@@ -69,8 +69,8 @@ repos:
# once it fails (a global fail_fast would hide every other failure).
- repo: local
hooks:
# REUSE compliance (licence files, SPDX data, REUSE.toml; docs/licensing.md in the
# environment repo). The wrapper tolerates only unused licence texts, see its docstring.
# REUSE compliance (licence files, SPDX data, REUSE.toml). The wrapper tolerates only
# unused licence texts, see its docstring.
- id: reuse-lint
name: REUSE compliance
description: reuse lint, tolerating unused licence texts until the roles arrive
+13 -6
View File
@@ -4,8 +4,8 @@ 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 repository. The design contract is ADR 0004 (in the
`mortis.kamino`: an Ansible Collection (GPL-3.0-or-later, REUSE-compliant) of reusable,
hardened roles. The design contract is ADR 0004 (in the
maintainer's environment repository). Roles arrive here wave by wave; `docker` is in 1.0.0, `fail2ban` in 1.1.0, `network_interfaces` and `systemd_hardening` in 1.2.0, `system_baseline` in 1.3.0, `ufw` in 1.4.0; 1.5.0 adds no role (new `system_baseline` options); `sshd` in 1.6.0; `user_management` in 1.7.0; `traefik`, with the internal `_binary_update`, in 1.8.0.
**Roadmap.** The roles still to come, and the ones that will never be extracted, are listed in
@@ -39,6 +39,13 @@ or create tags: those are the operator's.
hook run builds the Go hook environments and takes minutes: run commits in the background.
`git push` also runs `ansible-test sanity` on HEAD (`scripts/ansible-test-sanity.sh`, the Build
job's check, which ruff and the other hooks do not cover); its first run builds virtualenvs and takes minutes.
- **This repository stands alone.** No tracked file, issue or pull request text or comment,
release note or job output refers to another repository of the maintainer's, its documents,
hosts, network or namespaces, or states host sizing. Every comment states its own reason. When
bringing content in from another repository, before committing, search the incoming diff for
mentions of the source repository, its documents, hostnames, addresses, account namespaces and
sibling paths; rewrite comments so they stand alone; say in the pull request what was searched
for. No control holds this rule, and it has no expiry.
- Feature branch and pull request; `main` and `v*` tags are protected. Never push to `main`.
Releases are the operator's: annotated `vX.Y.Z` tags equal to `galaxy.yml`'s version.
- Conventional Commits. A PR says what was verified and what was not.
@@ -128,8 +135,8 @@ Single-context: `GLOSSARY.md` and `docs/adr/` at the root, both created lazily.
## Dependency automation (Renovate)
`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.
`kamino-docker` runner, as a Kamino-only bot user: this repository's jobs run only on its own
runners, and no credential from anywhere else is used here. Never reuse another Renovate credential here.
- **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`
@@ -164,8 +171,8 @@ maintainer's production environment. Never reuse another Renovate credential her
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.
- **Denied image namespace:** `check_image_versions.py pins` fails when anything under `.gitea/workflows`
mentions the image namespace this repository's CI must not use (the string is in the script).
- **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.
+9 -5
View File
@@ -2,10 +2,14 @@
- Open a pull request against `main`. The forge does not allow self-registration, so only
accounts the maintainer has created can open pull requests or issues for now. Fork
pull requests are not a supported path: a fork controls its own workflow file, and a test
showed workflows starting without an approval step. Workflows on fork pull requests get
pull requests are not a supported path: a fork controls its own workflow file. Workflows on fork pull requests get
no secrets and a read-only token. To discuss a contribution, write to the address in
`SECURITY.md`.
- This repository stands alone: nothing public here (a tracked file, issue or pull request
text or comment, release note or job output) refers to another repository of the maintainer's, its
documents, hosts, network or namespaces, or states host sizing. When you bring content in
from another repository, search the incoming diff for such mentions before committing,
rewrite comments so they stand alone, and say in the pull request what you searched for.
- 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/`
@@ -49,14 +53,14 @@
bumps the version and tags.
- `renovate.json` configures dependency bumps (minor and patch automerge, majors by hand). Renovate
runs for this repository in `.gitea/workflows/renovate.yml` (daily cron on the Collection's own
runner, as a Kamino-only bot user (repository secret `RENOVATE_BOT_TOKEN`); no cluster code involved). To dry-run after changing the
runner, as a Kamino-only bot user (repository secret `RENOVATE_BOT_TOKEN`); no credential from anywhere else is used). To dry-run after changing the
config: Actions > Renovate > Run workflow with `dry_run=true`, then read the debug log (the job fails on a failed clone or an ERROR problem). The dry run
proves reads (and runs the post-upgrade task); whether the bot can push and open a pull
request, and whether such pull requests start the PR workflows, only the first live run shows
(open item, see CLAUDE.md). Pull requests from `renovate/` branches must pass
`scripts/check_bot_pr_diff.py`, which only allows version, tag, digest and pin lines.
- Workflows must not mention `git.rkdr.net/defame1297/` (the production image set); the
`Check image pins` step fails if they do.
- Workflows must not mention `git.rkdr.net/defame1297/` (an image namespace this repository's
CI must not use); the `Check image pins` step fails if they do.
## Maintainer setup
+1 -1
View File
@@ -11,7 +11,7 @@ SPDX-FileCopyrightText = "Defame1297 and contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
# Third-party-derived content, so files without a header do not fall back to the
# Collection default (docs/licensing.md in the environment repo). "override"
# Collection default. "override"
# wins over the default and over any header. Later entries win over earlier ones.
# These paths arrive with their roles (wave 1 and 2).
+3 -3
View File
@@ -5,9 +5,9 @@ license: GPL-3.0-or-later
# Consumer side: holocron plugins are addressed as git+path objects rather than
# <name>@holocron marketplace aliases, so nothing outside this manifest is
# needed. Unpinned (default branch) on purpose, matching ../ansible and
# ../ai-development: Renovate cannot keep a pin current here. Its apm manager
# documents only the string form (not these git+path objects), is not in
# needed. Unpinned (default branch) on purpose: Renovate cannot keep a pin
# current here. Its apm manager documents only the string form (not these
# git+path objects), is not in
# renovate.json's enabledManagers, and holocron's v* tags are repo-wide and
# lag main (v2.0.1 is 164 commits behind and predates plugins/mattpocock). A
# hand-kept ref would just go stale. The third-party skills are pinned inside
+1 -1
View File
@@ -3,7 +3,7 @@
A disposable **Ubuntu 24.04** test target for the molecule scenarios of the
[`mortis.kamino`](https://git.rkdr.net/mortis/kamino) Ansible Collection: a container that behaves like a small
24.04 host (systemd as PID 1), so a role can be converged and verified in it without a VM.
It is the release of the home lab's LXC hosts today.
It is the release the hosts run today.
## What is in it
+3 -3
View File
@@ -1,5 +1,5 @@
---
# ansible-core 2.19 is what the environment repo's CI image pins
# (ci_python_tool_ansible_core_version). Raise this when a role needs a newer
# core; lowering it needs the molecule and sanity runs on the older core first.
# The roles were written against ansible-core 2.19 and nothing older has been
# tested. Raise this when a role needs a newer core; lowering it needs the molecule and
# sanity runs on the older core first.
requires_ansible: ">=2.19.0"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Run by .gitea/workflows/renovate.yml on the kamino-runner. Policy: automerge minor and patch, majors by hand. Every bot pull request must pass scripts/check_bot_pr_diff.py (lint workflow), which allows only version, tag, digest and pin lines. The top-level postUpgradeTasks runs scripts/bump_image_versions.py on every branch, lock refreshes included, which carry no package a packageRule could match (allowed by RENOVATE_ALLOWED_COMMANDS of .gitea/workflows/renovate.yml, where Renovate runs).",
"description": "Run by .gitea/workflows/renovate.yml on this repository's own runner. Policy: automerge minor and patch, majors by hand. Every bot pull request must pass scripts/check_bot_pr_diff.py (lint workflow), which allows only version, tag, digest and pin lines. The top-level postUpgradeTasks runs scripts/bump_image_versions.py on every branch, lock refreshes included, which carry no package a packageRule could match (allowed by RENOVATE_ALLOWED_COMMANDS of .gitea/workflows/renovate.yml, where Renovate runs).",
"extends": [
"config:recommended",
":enablePreCommit"
-2
View File
@@ -4,8 +4,6 @@
# package too, with the sha256 of each release file) and is what gets installed; pip refuses an
# install in which the two files disagree. Renovate bumps a pin here and regenerates the lock
# (pip-compile manager); by hand, run scripts/lock-requirements.sh and commit both files (#113).
# ansible-core and ansible-lint started equal to the environment repo's runner image
# (hosts/group_vars/all/ci_python_tools.yml there) and are no longer kept equal automatically.
# Renovate (renovate.json) bumps these pins; a bump rebuilds the ci image (images/ci) and
# Renovate then moves the consumers' pins to it.
ansible-core==2.22.0
+6 -7
View File
@@ -12,9 +12,8 @@ cannot make a tag immutable), so an image whose content changes under an unchang
version is pushed as sha-*/latest only, and a hand-pasted <version>@<new digest> pin
would pair a tag with a digest it does not point to.
pins No file under .gitea/workflows may mention `git.rkdr.net/defame1297/`: the production
image set of the environment repo never belongs in this CI (the `mortis` side is the
untrusted one, ADR 0004 Runner isolation).
pins No file under .gitea/workflows may mention `git.rkdr.net/defame1297/`: an image
namespace this repository's CI must not use (ADR 0004 Runner isolation).
Every `git.rkdr.net/mortis/<name>:<version>@sha256:<digest>` in the consumer
workflows must name an image of the matrix, with a well-formed digest and a
version that is not newer than the matrix (a pin lags the matrix between the PR
@@ -80,7 +79,7 @@ ANY_PIN_RE = re.compile(
r"""(?:[:@][^\s,)\]}'"]*)?""",
re.IGNORECASE,
)
# The production image namespace of the environment repo; any spelling of the host's case.
# An image namespace this repository's CI must not use; any spelling of the host's case.
FOREIGN_RE = re.compile(r"git\.rkdr\.net(?::[0-9]+)?/defame1297/", re.IGNORECASE)
WORKFLOW_DIR = ".gitea/workflows"
# Semver 2.0.0: no leading zeros in numeric identifiers (core or prerelease).
@@ -644,10 +643,10 @@ def changed_images(head_matrix, changed, read_head_file):
def check_foreign_images(workflow_texts):
"""Errors for each workflow file that mentions the production image namespace, comments included."""
"""Errors for each workflow file that mentions the denied image namespace, comments included."""
return [
f"{fname}: mentions git.rkdr.net/defame1297/, the production image set; the Collection's CI "
"must never use or name it"
f"{fname}: mentions git.rkdr.net/defame1297/, an image namespace this repository's CI "
"must not use or name"
for fname, text in sorted(workflow_texts.items())
if FOREIGN_RE.search(text)
]
+1 -1
View File
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
"""Run `reuse lint`, tolerating only unused licence texts.
LICENSES/ carries the texts docs/licensing.md lists (GPL-3.0-only, Apache-2.0, MIT,
LICENSES/ carries licence texts (GPL-3.0-only, Apache-2.0, MIT,
EUPL-1.2) before the roles that use them exist; reuse >= 6 reports those as
non-compliant. Every other finding still fails. Once the extraction waves have brought
in files for all of them, delete UNUSED_ALLOWED and call `reuse lint` directly.
+14 -4
View File
@@ -129,9 +129,9 @@ class PureTest(unittest.TestCase):
def matrix(self, mol="0.1.0", ci="0.2.0"):
return civ.matrix_of(IMAGE_YML.format(mol=mol, ci=ci))
def test_foreign_production_images_are_denied(self):
def test_images_of_the_denied_namespace_are_refused(self):
for text in (
"image: git.rkdr.net/defame1297/gitea-ansible-runner:1@sha256:" + "a" * 64,
"image: git.rkdr.net/defame1297/some-image:1@sha256:" + "a" * 64,
"# GIT.RKDR.NET:443/Defame1297/x",
"image: git.rkdr.net/defame1297/y",
):
@@ -139,10 +139,20 @@ class PureTest(unittest.TestCase):
for text in (
"image: git.rkdr.net/mortis/ci:0.2.0",
"https://git.rkdr.net/defame1297x",
"see Defame1297/ansible-homelab-mono",
"see Defame1297/some-repository",
):
self.assertEqual(civ.check_foreign_images({"w.yml": text}), [], text)
def test_the_refusal_names_the_namespace_and_nothing_about_its_use(self):
(message,) = civ.check_foreign_images(
{"w.yml": "image: git.rkdr.net/defame1297/y"}
)
self.assertEqual(
message,
"w.yml: mentions git.rkdr.net/defame1297/, an image namespace this repository's CI "
"must not use or name",
)
def test_pins_ok_and_lagging(self):
pin = f"image: git.rkdr.net/mortis/ci:0.1.0@{DIGEST}\n"
self.assertEqual(civ.check_pins(self.matrix(), {"lint.yml": pin}), [])
@@ -717,7 +727,7 @@ class GitTest(unittest.TestCase):
self.assertIn(text, err)
self.assertEqual(len(err.strip().splitlines()), 1, err)
def test_pins_cli_denies_a_production_image_in_any_workflow(self):
def test_pins_cli_refuses_the_denied_namespace_in_any_workflow(self):
self.write(".gitea/workflows/lint.yml", "name: Lint\n")
self.assertEqual(self.bump_args("pins")[0], 0)
self.write(