feat: scaffold the mortis.kamino Collection (no roles yet) #1

Merged
Defame1297 merged 9 commits from feat/scaffold into main 2026-10-25 07:34:16 +00:00
Owner

Initial repository scaffolding. No roles move in this PR: the Collection starts with zero roles, and no image digest is referenced.

What is in it

  • galaxy.yml (mortis.kamino, version 0.1.0 as the working version; the first release is 1.0.0), meta/runtime.yml (requires_ansible >=2.19.0), an empty roles/, README, CONTRIBUTING.
  • GPL-3.0-or-later licensing: COPYING, LICENSES/ (five texts, byte-identical to SPDX license-list-data), NOTICE, REUSE.toml. scripts/reuse_lint.py wraps reuse lint and tolerates only the four licence texts that no file uses yet; remove it once the roles land.
  • pre-commit (conventional-pre-commit, gitleaks, yamllint, ansible-lint production profile with var-naming[no-role-prefix], antsibull-changelog lint, REUSE, actionlint), changelogs/, pinned requirements-dev.txt.
  • Workflows, all runs-on: kamino-docker (never the production labels), with explicit timeouts and least-privilege permissions:
    • lint.yml: pre-commit on all files, gitleaks over the PR commits, Conventional Commits check.
    • build.yml: ansible-galaxy collection build, galaxy-importer without ansible-test, ansible-test sanity; on v* tags it also checks that the tag is annotated and equals v plus the galaxy.yml version. It uploads nothing.
    • image.yml: builds images/molecule-ubuntu2404 with kaniko v1.28.6 and pushes git.rkdr.net/mortis/molecule-ubuntu2404, on push to main (path filtered), v* tags and manual dispatch only, never on pull_request.
  • images/molecule-ubuntu2404/Dockerfile: the systemd-capable Ubuntu 24.04 test target (same package set as the image it replaces), base pinned by digest, one layer of about 30 MB compressed.

Design notes

  • Job container: ubuntu:24.04 by digest, not the kaniko image. act starts job containers with /bin/sleep, which the kaniko debug image lacks. The kaniko executor is downloaded by layer digest and verified with sha256sum.
  • Sources: no Node in the container, so no actions/checkout. Lint and build clone with the job token; kaniko clones its own context (git:// means https in v1.28.6).
  • Prepare step: kaniko builds in the job container's own filesystem, so the prepare step installs curl, fetches the executor, then purges exactly the packages it added and fails the job if package versions or files under /usr, /lib, /bin, /sbin, /opt, /etc differ from the base image.
  • No kaniko cache. The image is small and rarely rebuilt, and cache layers would go through the same size-limited path.
  • Memory: the job container has a memory cap (runner capacity 1).

Credential for pushing the image

The job tries the Actions job token first (permissions: packages: write). Gitea 28.0.0 most likely refuses it for an organisation-owned package (services/context/package.go, "TODO: ActionUser permission check"), but this is untested and the first run answers it. The log and step summary say which method worked. Only if the registry answers 401/403 does the job fall back to the org Actions secrets PACKAGE_PUSH_USER and PACKAGE_PUSH_TOKEN. A bot user and a token with write:package are a conditional fallback, not a prerequisite. If the job token is refused and the secrets are unset, the job fails with a message naming them.

Review

Three independent read-only reviews (workflows, image, metadata and licensing) found no critical or high defects. The fixes are in the last three commits: environment instead of interpolation in run: steps, tag validation, a deterministic purge and a package//etc check in the prepare step, an empty-body registry probe, credential removal after the push, one image layer, corrected fork pull request policy in CONTRIBUTING, and a maintainer setup section.

Not verified (the first runs are the test)

  • Nothing has run on Gitea Actions yet. lint.yml and build.yml run on this PR; image.yml first runs when this is merged. Validated locally: pre-commit on all files, actionlint with shellcheck, ansible-galaxy collection build, galaxy-importer (RUN_ANSIBLE_TEST=False), ansible-test sanity (Python 3.11 only).
  • Not exercised: kaniko under Docker's default seccomp and AppArmor on the runner (apparmor=unconfined may be needed), the prepare/purge check against a real ubuntu:24.04 container (the install could upgrade base packages if the archive is newer than the pinned base; the job then fails with the package diff), the image build itself and its real layer sizes, the job-token push, and container: image@sha256:… on this Gitea.
  • After the first push, list the layers (crane export | tar t) and look for run/act, root/ and var/log/apt: files the prepare step touched may land in the first layer (cosmetic).

Before merging and before the first tag

  1. Keep this repository private until the Collection runner is network-isolated.
  2. Protect v* tags (maintainers only). A tag run uses the tagged commit's workflow files and may receive organisation secrets.
  3. Protect main with the Lint and Build checks.
  4. Confirm the copyright holder in NOTICE, galaxy.yml and REUSE.toml (currently Defame1297) and that the commit author address is acceptable for a public repository.
  5. If the first image run reports the job token was refused: create the bot user, a token with write:package, and the two org secrets, then re-run. After the push, copy the printed git.rkdr.net/mortis/molecule-ubuntu2404@sha256:… digest and make the package public (packages follow the organisation's visibility).

Not in this PR

The molecule workflow. It needs the digest of the first pushed image, so it arrives with the first roles (wave 1): runs-on: kamino-molecule (host executor, same-repo non-bot PRs only, permissions: contents: read), scenarios with platforms[].image: git.rkdr.net/mortis/molecule-ubuntu2404@sha256:<digest> and pre_build_image: true.

🤖 Generated with Claude Code

Initial repository scaffolding. No roles move in this PR: the Collection starts with zero roles, and no image digest is referenced. ## What is in it - `galaxy.yml` (`mortis.kamino`, version 0.1.0 as the working version; the first release is 1.0.0), `meta/runtime.yml` (`requires_ansible >=2.19.0`), an empty `roles/`, README, CONTRIBUTING. - GPL-3.0-or-later licensing: `COPYING`, `LICENSES/` (five texts, byte-identical to SPDX license-list-data), `NOTICE`, `REUSE.toml`. `scripts/reuse_lint.py` wraps `reuse lint` and tolerates only the four licence texts that no file uses yet; remove it once the roles land. - pre-commit (conventional-pre-commit, gitleaks, yamllint, ansible-lint production profile with `var-naming[no-role-prefix]`, antsibull-changelog lint, REUSE, actionlint), `changelogs/`, pinned `requirements-dev.txt`. - Workflows, all `runs-on: kamino-docker` (never the production labels), with explicit timeouts and least-privilege permissions: - `lint.yml`: pre-commit on all files, gitleaks over the PR commits, Conventional Commits check. - `build.yml`: `ansible-galaxy collection build`, galaxy-importer without ansible-test, `ansible-test sanity`; on `v*` tags it also checks that the tag is annotated and equals `v` plus the `galaxy.yml` version. It uploads nothing. - `image.yml`: builds `images/molecule-ubuntu2404` with kaniko v1.28.6 and pushes `git.rkdr.net/mortis/molecule-ubuntu2404`, on push to `main` (path filtered), `v*` tags and manual dispatch only, never on `pull_request`. - `images/molecule-ubuntu2404/Dockerfile`: the systemd-capable Ubuntu 24.04 test target (same package set as the image it replaces), base pinned by digest, one layer of about 30 MB compressed. ## Design notes - **Job container:** `ubuntu:24.04` by digest, not the kaniko image. act starts job containers with `/bin/sleep`, which the kaniko debug image lacks. The kaniko executor is downloaded by layer digest and verified with `sha256sum`. - **Sources:** no Node in the container, so no `actions/checkout`. Lint and build clone with the job token; kaniko clones its own context (`git://` means https in v1.28.6). - **Prepare step:** kaniko builds in the job container's own filesystem, so the prepare step installs curl, fetches the executor, then purges exactly the packages it added and fails the job if package versions or files under `/usr`, `/lib`, `/bin`, `/sbin`, `/opt`, `/etc` differ from the base image. - **No kaniko cache.** The image is small and rarely rebuilt, and cache layers would go through the same size-limited path. - **Memory:** the job container has a memory cap (runner capacity 1). ## Credential for pushing the image The job tries the Actions job token first (`permissions: packages: write`). Gitea 28.0.0 most likely refuses it for an organisation-owned package (`services/context/package.go`, "TODO: ActionUser permission check"), but this is untested and the first run answers it. The log and step summary say which method worked. Only if the registry answers 401/403 does the job fall back to the org Actions secrets `PACKAGE_PUSH_USER` and `PACKAGE_PUSH_TOKEN`. A bot user and a token with `write:package` are a conditional fallback, not a prerequisite. If the job token is refused and the secrets are unset, the job fails with a message naming them. ## Review Three independent read-only reviews (workflows, image, metadata and licensing) found no critical or high defects. The fixes are in the last three commits: environment instead of interpolation in `run:` steps, tag validation, a deterministic purge and a package/`/etc` check in the prepare step, an empty-body registry probe, credential removal after the push, one image layer, corrected fork pull request policy in CONTRIBUTING, and a maintainer setup section. ## Not verified (the first runs are the test) - Nothing has run on Gitea Actions yet. `lint.yml` and `build.yml` run on this PR; `image.yml` first runs when this is merged. Validated locally: pre-commit on all files, actionlint with shellcheck, `ansible-galaxy collection build`, galaxy-importer (`RUN_ANSIBLE_TEST=False`), `ansible-test sanity` (Python 3.11 only). - Not exercised: kaniko under Docker's default seccomp and AppArmor on the runner (`apparmor=unconfined` may be needed), the prepare/purge check against a real `ubuntu:24.04` container (the install could upgrade base packages if the archive is newer than the pinned base; the job then fails with the package diff), the image build itself and its real layer sizes, the job-token push, and `container: image@sha256:…` on this Gitea. - After the first push, list the layers (`crane export | tar t`) and look for `run/act`, `root/` and `var/log/apt`: files the prepare step touched may land in the first layer (cosmetic). ## Before merging and before the first tag 1. Keep this repository private until the Collection runner is network-isolated. 2. Protect `v*` tags (maintainers only). A tag run uses the tagged commit's workflow files and may receive organisation secrets. 3. Protect `main` with the `Lint` and `Build` checks. 4. Confirm the copyright holder in `NOTICE`, `galaxy.yml` and `REUSE.toml` (currently Defame1297) and that the commit author address is acceptable for a public repository. 5. If the first image run reports the job token was refused: create the bot user, a token with `write:package`, and the two org secrets, then re-run. After the push, copy the printed `git.rkdr.net/mortis/molecule-ubuntu2404@sha256:…` digest and make the package public (packages follow the organisation's visibility). ## Not in this PR The molecule workflow. It needs the digest of the first pushed image, so it arrives with the first roles (wave 1): `runs-on: kamino-molecule` (host executor, same-repo non-bot PRs only, `permissions: contents: read`), scenarios with `platforms[].image: git.rkdr.net/mortis/molecule-ubuntu2404@sha256:<digest>` and `pre_build_image: true`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 9 commits 2026-10-24 21:10:51 +00:00
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Pass ref and repository values to run steps as environment instead of
interpolating them into the script (a tag name may contain shell
metacharacters). In the image workflow: refuse tags that are not
vMAJOR.MINOR.PATCH[-prerelease] before anything runs, purge exactly the
packages the prepare step added instead of autoremove and fail on any
package or /etc file difference from the base image, send the registry
write probe with an empty body, and remove the registry credential after
the push also when the build fails.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
One layer is about 30 MB compressed, far below the 100 MB proxy limit, and
saves three kaniko snapshots and three apt index downloads. Correct the size
estimate and the python3-systemd comment, note the build-time SSH host keys,
and drop the internal image name.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
docs: correct the fork pull request policy and add maintainer setup
Lint / lint (pull_request) Successful in 1m26s
Build / build (pull_request) Successful in 50s
3869718450
State the real Gitea approval rule for fork pull requests, require a
REUSE.toml annotation for third-party material, describe the release
changelog files, and list the repository settings the workflows cannot
enforce (protected v* tags, protected main, the package push credential).
Drop the references to the private environment repository.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Defame1297 approved these changes 2026-10-25 07:33:55 +00:00
Defame1297 merged commit dcfcbd105e into main 2026-10-25 07:34:16 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#1