Compare commits
15
Commits
v1.8.0
...
d30e32e49f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d30e32e49f | ||
|
|
308589e7f9 | ||
|
|
e45b92551a | ||
|
|
96a090cead | ||
|
|
844c152d6a | ||
|
|
3c6fd325fb | ||
|
|
00e4e9d945 | ||
|
|
dfeb423db1 | ||
|
|
c1f03708d8 | ||
|
|
e42713c74e | ||
|
|
97392728de | ||
|
|
d4c68933d4 | ||
|
|
54cf2df6ff | ||
|
|
68ceb6e2b5 | ||
|
|
3384ff2836 |
No files matched your search
+1
-1
@@ -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.
|
# var-naming[no-role-prefix]: every role variable carries the role name as a prefix.
|
||||||
profile: production
|
profile: production
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Runner labels used by the workflows, so actionlint accepts them. These belong
|
# 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
|
# to the Collection's own runner (scoped to the mortis org). No other label is
|
||||||
# labels (docker, ubuntu-lxc, molecule) are deliberately not listed, so a
|
# listed, so a workflow that names one fails actionlint: this repository's jobs
|
||||||
# workflow that names one fails actionlint.
|
# run only on its own runners.
|
||||||
self-hosted-runner:
|
self-hosted-runner:
|
||||||
labels:
|
labels:
|
||||||
- kamino-docker
|
- kamino-docker
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
# Builds the Collection tarball and checks it. On a v* tag it also checks the release
|
# 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; the ADR is in the
|
# invariants (annotated tag, tag equals v + galaxy.yml version). Nothing is
|
||||||
# maintainer's environment repository). Nothing is
|
|
||||||
# uploaded: the tarball is built in a temporary directory and discarded. Releases are
|
# 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.
|
# 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
|
on: # yamllint disable-line rule:truthy
|
||||||
@@ -32,7 +31,7 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
# The ci image (images/ci, built by image.yml): tag for the release, digest enforced.
|
# The ci image (images/ci, built by image.yml): tag for the release, digest enforced.
|
||||||
container:
|
container:
|
||||||
image: git.rkdr.net/mortis/ci:0.2.28@sha256:5236f475d9aa5446cecee4bb23becd411df3cb12963650d2f5821ef2b9d73b7c
|
image: git.rkdr.net/mortis/ci:0.2.30@sha256:5d11d0783d31b39e288101b32eb09f333dc6a8482592dea99cb9078573d47602
|
||||||
env:
|
env:
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
||||||
steps:
|
steps:
|
||||||
@@ -70,7 +69,7 @@ jobs:
|
|||||||
/opt/venv/bin/pip install --quiet --require-hashes -r requirements-dev.lock -r requirements-dev.txt
|
/opt/venv/bin/pip install --quiet --require-hashes -r requirements-dev.lock -r requirements-dev.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ADR 0004, Release process: the tag is annotated and equals v + the galaxy.yml version.
|
# The release tag is annotated and equals v + the galaxy.yml version.
|
||||||
- name: Check the release tag
|
- name: Check the release tag
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
env:
|
env:
|
||||||
@@ -124,8 +123,8 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
python3 scripts/check_tarball.py "$1"
|
python3 scripts/check_tarball.py "$1"
|
||||||
|
|
||||||
# galaxy-importer without ansible-test and without Docker (ADR 0004, Collection
|
# galaxy-importer without ansible-test and without Docker. The importer reads its
|
||||||
# repo gates). The importer reads its configuration from this file.
|
# configuration from this file.
|
||||||
- name: Run galaxy-importer
|
- name: Run galaxy-importer
|
||||||
run: |
|
run: |
|
||||||
export PATH="/opt/venv/bin:$PATH"
|
export PATH="/opt/venv/bin:$PATH"
|
||||||
|
|||||||
+27
-43
@@ -1,7 +1,7 @@
|
|||||||
name: Images
|
name: Images
|
||||||
|
|
||||||
# Builds the images under images/ with kaniko (osscontainertools fork, v1.28.6) and
|
# Builds the images under images/ with kaniko (osscontainertools fork, v1.28.6) and
|
||||||
# pushes them to git.rkdr.net/mortis/<name> (ADR 0004 in the maintainer's environment repository, Image distribution): the molecule
|
# pushes them to git.rkdr.net/mortis/<name>: the molecule
|
||||||
# test targets (molecule-ubuntu2404, molecule-ubuntu2604) and the lint/build tooling (ci).
|
# 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
|
# Never on pull_request: a workflow file comes from the PR head, so a fork PR could
|
||||||
@@ -22,16 +22,16 @@ name: Images
|
|||||||
# same Ubuntu release as the FROM lines of the image's Dockerfile (check_image_versions.py
|
# same Ubuntu release as the FROM lines of the image's Dockerfile (check_image_versions.py
|
||||||
# pins enforces it; run 2529 broke a 24.04 build in a 26.04 job container: GLIBC_2.42
|
# pins enforces it; run 2529 broke a 24.04 build in a 26.04 job container: GLIBC_2.42
|
||||||
# not found).
|
# not found).
|
||||||
# - Credentials: the job token is tried first (permissions: packages: write). Gitea 28
|
# - Credentials: the push uses the org secrets PACKAGE_PUSH_USER / PACKAGE_PUSH_TOKEN only.
|
||||||
# refuses it for an organisation-owned package (HTTP 401 on a write probe, run 2237:
|
# The job token cannot write an organisation-owned package on Gitea 28 (HTTP 401 on a
|
||||||
# the Actions user is not an org member, services/context/package.go, TODO ActionUser
|
# write probe: the Actions user is not an org member), so the workflow asks for no
|
||||||
# permission check). Only if a write probe is refused are the org secrets
|
# packages permission. One write probe checks the token before anything is built and
|
||||||
# PACKAGE_PUSH_USER / PACKAGE_PUSH_TOKEN used. The log names the method that worked,
|
# fails the job when it is refused. Revisit when a Gitea release lets the job token
|
||||||
# never a value.
|
# write organisation packages.
|
||||||
# - Layers: every layer stays far below Cloudflare's 100 MB request-body limit (see the
|
# - 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
|
# Dockerfile). No kaniko cache: a tiny, rarely rebuilt image gains little, and cache
|
||||||
# layers would be pushed through the same Cloudflare-limited path.
|
# 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
|
on: # yamllint disable-line rule:truthy
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -48,7 +48,6 @@ on: # yamllint disable-line rule:truthy
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
|
||||||
|
|
||||||
# One image build at a time; a later run must not cancel a push in progress.
|
# One image build at a time; a later run must not cancel a push in progress.
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -88,13 +87,13 @@ jobs:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
||||||
- name: ci
|
- name: ci
|
||||||
version: 0.2.29
|
version: 0.2.32
|
||||||
subpath: ""
|
subpath: ""
|
||||||
dockerfile: images/ci/Dockerfile
|
dockerfile: images/ci/Dockerfile
|
||||||
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.job_image }}
|
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
|
options: --memory=2g --memory-swap=2g
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
@@ -133,15 +132,13 @@ jobs:
|
|||||||
# Its CA bundle (layers[1]) and executor (layers[9], both 0-based) are fetched by content digest and
|
# Its CA bundle (layers[1]) and executor (layers[9], both 0-based) are fetched by content digest and
|
||||||
# verified with sha256sum.
|
# verified with sha256sum.
|
||||||
#
|
#
|
||||||
# The credential: the job token first; the org secrets only after a write probe was
|
# The credential: the org push token, checked by one write probe before the build.
|
||||||
# refused. Credentials reach commands only through the environment and curl's stdin
|
# Credentials reach commands only through the environment and curl's stdin
|
||||||
# config, never the argument list or the log. Writes /kaniko/.docker/config.json.
|
# config, never the argument list or the log. Writes /kaniko/.docker/config.json.
|
||||||
- name: Prepare kaniko and select the registry credential
|
- name: Prepare kaniko and check the registry credential
|
||||||
env:
|
env:
|
||||||
KANIKO_CA_LAYER_SHA256: 5ecab5922e6a5124fab96e8cb404b8cf93e8a96716af4fbbea2a9221b1216f86
|
KANIKO_CA_LAYER_SHA256: 5ecab5922e6a5124fab96e8cb404b8cf93e8a96716af4fbbea2a9221b1216f86
|
||||||
KANIKO_EXECUTOR_LAYER_SHA256: 49c71aa9e7197af5dcf12811395f182f831c7e714ba94241908c955dd1649ca7
|
KANIKO_EXECUTOR_LAYER_SHA256: 49c71aa9e7197af5dcf12811395f182f831c7e714ba94241908c955dd1649ca7
|
||||||
JOB_USER: ${{ github.actor }}
|
|
||||||
JOB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
PAT_USER: ${{ secrets.PACKAGE_PUSH_USER }}
|
PAT_USER: ${{ secrets.PACKAGE_PUSH_USER }}
|
||||||
PAT_TOKEN: ${{ secrets.PACKAGE_PUSH_TOKEN }}
|
PAT_TOKEN: ${{ secrets.PACKAGE_PUSH_TOKEN }}
|
||||||
SERVER_URL: ${{ github.server_url }}
|
SERVER_URL: ${{ github.server_url }}
|
||||||
@@ -196,33 +193,20 @@ jobs:
|
|||||||
(umask 077; printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$registry" "$auth" > /kaniko/.docker/config.json)
|
(umask 077; printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$registry" "$auth" > /kaniko/.docker/config.json)
|
||||||
}
|
}
|
||||||
|
|
||||||
code="$(probe "$JOB_USER" "$JOB_TOKEN")"
|
if [ -z "$PAT_USER" ] || [ -z "$PAT_TOKEN" ]; then
|
||||||
if [ "$code" = "202" ]; then
|
echo "::error::The org Actions secrets PACKAGE_PUSH_USER and PACKAGE_PUSH_TOKEN are not set." \
|
||||||
write_config "$JOB_USER" "$JOB_TOKEN"
|
"Create a bot user with write access to the mortis packages and a personal access token" \
|
||||||
method="job-token"
|
"with the write:package scope, and store them as those two org secrets."
|
||||||
elif [ "$code" = "401" ] || [ "$code" = "403" ]; then
|
|
||||||
echo "The Actions job token was refused for a package write (HTTP $code)."
|
|
||||||
if [ -z "$PAT_USER" ] || [ -z "$PAT_TOKEN" ]; then
|
|
||||||
echo "::error::The job token cannot push to the organisation's packages, and the org Actions" \
|
|
||||||
"secrets PACKAGE_PUSH_USER and PACKAGE_PUSH_TOKEN are not set. Create a bot user with write" \
|
|
||||||
"access to the mortis packages and a personal access token with the write:package scope," \
|
|
||||||
"and store them as those two org secrets."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
code="$(probe "$PAT_USER" "$PAT_TOKEN")"
|
|
||||||
if [ "$code" != "202" ]; then
|
|
||||||
echo "::error::The PACKAGE_PUSH_USER / PACKAGE_PUSH_TOKEN credential was refused too" \
|
|
||||||
"(HTTP $code). Check the token's write:package scope and the bot user's access to the org."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
write_config "$PAT_USER" "$PAT_TOKEN"
|
|
||||||
method="org-secrets (PACKAGE_PUSH_USER / PACKAGE_PUSH_TOKEN)"
|
|
||||||
else
|
|
||||||
echo "::error::Unexpected HTTP status $code from the registry write probe; not trying another credential."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "$method" > /kaniko/credential-method
|
code="$(probe "$PAT_USER" "$PAT_TOKEN")"
|
||||||
echo "Registry credential in use: $method"
|
if [ "$code" != "202" ]; then
|
||||||
|
echo "::error::The PACKAGE_PUSH_USER / PACKAGE_PUSH_TOKEN credential was refused (HTTP $code)." \
|
||||||
|
"Check the token's write:package scope and the bot user's access to the org."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
write_config "$PAT_USER" "$PAT_TOKEN"
|
||||||
|
echo "Registry credential accepted: PACKAGE_PUSH_USER / PACKAGE_PUSH_TOKEN"
|
||||||
|
|
||||||
# Gitea cannot make a tag immutable, so look the version tag up first: when it
|
# Gitea cannot make a tag immutable, so look the version tag up first: when it
|
||||||
# exists the build must not move it (the build step reads this marker).
|
# exists the build must not move it (the build step reads this marker).
|
||||||
@@ -307,8 +291,8 @@ jobs:
|
|||||||
if [ -n "$SUBPATH" ]; then ctx+=(--context-sub-path "$SUBPATH"); fi
|
if [ -n "$SUBPATH" ]; then ctx+=(--context-sub-path "$SUBPATH"); fi
|
||||||
#
|
#
|
||||||
# When it finishes the executor has replaced the job container's filesystem with
|
# When it finishes the executor has replaced the job container's filesystem with
|
||||||
# the built image and removed /kaniko, so nothing written there (a --digest-file,
|
# the built image and removed /kaniko, so nothing written there (a --digest-file)
|
||||||
# the credential method) can be read back. Take the digest from its
|
# can be read back. Take the digest from its
|
||||||
# "Pushed <image>@sha256:<digest>" log line into a variable of this shell, which
|
# "Pushed <image>@sha256:<digest>" log line into a variable of this shell, which
|
||||||
# needs only builtins by then.
|
# needs only builtins by then.
|
||||||
digest=""
|
digest=""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: Lint
|
name: Lint
|
||||||
|
|
||||||
# Runs on the Collection's own runner (label kamino-docker, scoped to the mortis org),
|
# Runs only 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
|
# 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.
|
# 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
|
# 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
|
# tools of requirements-dev.txt, the collections of requirements.yml and the hook
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
# The tag says which release, the digest is what is enforced (bump both together
|
# The tag says which release, the digest is what is enforced (bump both together
|
||||||
# when image.yml publishes a new version).
|
# when image.yml publishes a new version).
|
||||||
container:
|
container:
|
||||||
image: git.rkdr.net/mortis/ci:0.2.28@sha256:5236f475d9aa5446cecee4bb23becd411df3cb12963650d2f5821ef2b9d73b7c
|
image: git.rkdr.net/mortis/ci:0.2.30@sha256:5d11d0783d31b39e288101b32eb09f333dc6a8482592dea99cb9078573d47602
|
||||||
env:
|
env:
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
||||||
PRE_COMMIT_HOME: /opt/pre-commit
|
PRE_COMMIT_HOME: /opt/pre-commit
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
ANSIBLE_COLLECTIONS_PATH: /opt/collections
|
ANSIBLE_COLLECTIONS_PATH: /opt/collections
|
||||||
steps:
|
steps:
|
||||||
# The container has no Node, so JavaScript actions such as actions/checkout
|
# 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
|
- name: Checkout the commit under test
|
||||||
env:
|
env:
|
||||||
GIT_CONFIG_COUNT: "1"
|
GIT_CONFIG_COUNT: "1"
|
||||||
|
|||||||
@@ -4,21 +4,14 @@ name: Molecule
|
|||||||
# extensions/molecule/*/ and roles/*/molecule/*/. extensions/molecule/image-smoke and
|
# 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.
|
# 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
|
# It runs on the `kamino-molecule` label, a host executor that uses the runner's own
|
||||||
# that LXC's own Docker daemon; no job container is given the Docker socket. That makes
|
# Docker daemon; no job container is given the Docker socket. That makes the job
|
||||||
# the job root-equivalent on the runner LXC, which is rebuildable and holds no
|
# root-equivalent on the runner, which is disposable and holds no secret from outside
|
||||||
# production secret (ADR 0004 in the maintainer's environment repository, Runner
|
# this repository. The `if:` guard is a convenience filter, not a boundary: a fork controls its
|
||||||
# isolation). The runner sits in an isolated network segment (outbound DNS to two
|
# own workflow file. So the repository does not accept fork pull requests; the real
|
||||||
# resolvers and web traffic only; inbound SSH from two management hosts only), so a
|
# condition is that only trusted people can push branches or open pull requests here.
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
# 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
|
# 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:
|
# 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
|
# the job installs both, cached on the runner by their checksum. The test image is pulled from
|
||||||
@@ -53,8 +46,8 @@ permissions:
|
|||||||
# same rule as lint.yml and build.yml); a run on main is never cancelled, so its group is the
|
# 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
|
# 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
|
# 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
|
# runner's single slot does. Raise the runner's capacity and this needs a lock or a shared
|
||||||
# repository). Raise that capacity and this needs a lock or a shared group again.
|
# group again.
|
||||||
concurrency:
|
concurrency:
|
||||||
group: molecule-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
|
group: molecule-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||||
@@ -82,12 +75,12 @@ jobs:
|
|||||||
MOLECULE_IMAGE_2604: >-
|
MOLECULE_IMAGE_2604: >-
|
||||||
git.rkdr.net/mortis/molecule-ubuntu2604:0.1.5@sha256:4ba40ee3603a33778254f22bc0f9360b9f7dd0ed5c03c5b2f935186c7b84dd6f
|
git.rkdr.net/mortis/molecule-ubuntu2604:0.1.5@sha256:4ba40ee3603a33778254f22bc0f9360b9f7dd0ed5c03c5b2f935186c7b84dd6f
|
||||||
steps:
|
steps:
|
||||||
# The molecule venv is provisioned by the gitea_runner role (install_services); fail with
|
# The molecule venv is provisioned on the runner, not by this job; fail with a clear
|
||||||
# a clear message when this runs before it has.
|
# message when it is missing.
|
||||||
- name: Check the provisioned tooling
|
- name: Check the provisioned tooling
|
||||||
run: |
|
run: |
|
||||||
if ! test -x "$MOLECULE_VENV/bin/molecule"; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
docker version --format '{{.Server.Version}}' || { echo "::error::the Docker daemon is not reachable by the runner user"; exit 1; }
|
docker version --format '{{.Server.Version}}' || { echo "::error::the Docker daemon is not reachable by the runner user"; exit 1; }
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
name: Renovate
|
name: Renovate
|
||||||
|
|
||||||
# Dependency updates for this repository (renovate.json). Runs on the Collection's own runner
|
# Dependency updates for this repository (renovate.json). Runs only on the Collection's own runner
|
||||||
# (label kamino-docker, the untrusted side), never in the production cluster: code from this
|
# (label kamino-docker), and no credential from anywhere else is used here.
|
||||||
# repository must not run there. The credential is the token of a Kamino-only bot user, held as
|
# 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 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,
|
# 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
|
# 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'
|
if: github.repository == 'mortis/kamino' || github.repository == 'Mortis/Kamino'
|
||||||
runs-on: kamino-docker
|
runs-on: kamino-docker
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
# Docker Hub image, pinned by digest like the cluster's CronJob (same version). The -full
|
# Docker Hub image, pinned by digest. The -full flavour ships python3 for the
|
||||||
# flavour ships python3 for the postUpgradeTasks command. Hand-bumped: renovate.json
|
# postUpgradeTasks command. Hand-bumped: renovate.json
|
||||||
# disables updates for this file. The image sets RENOVATE_BINARY_SOURCE=global, so pip-compile
|
# 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
|
# 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
|
# reads from the lock header: that python's minor version must equal .python-version, or a lock
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ vault-pass*
|
|||||||
gitleaks-report.json
|
gitleaks-report.json
|
||||||
# galaxy-importer output
|
# galaxy-importer output
|
||||||
importer_result.json
|
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.
|
# agents and hooks are `apm install` deploy output, regenerated on every install.
|
||||||
apm_modules/
|
apm_modules/
|
||||||
.claude/skills/
|
.claude/skills/
|
||||||
|
|||||||
+14
-2
@@ -63,14 +63,26 @@ repos:
|
|||||||
files: ^\.gitea/workflows/.*\.ya?ml$
|
files: ^\.gitea/workflows/.*\.ya?ml$
|
||||||
stages: ['pre-commit']
|
stages: ['pre-commit']
|
||||||
|
|
||||||
|
# zizmor finds security problems in workflows (pull_request_target, ${{ }} expanded into
|
||||||
|
# run:). Its own files: pattern only matches .github/, so point it at .gitea/workflows.
|
||||||
|
# --offline: no network audits, so a run needs no token and gives the same result everywhere.
|
||||||
|
# Overriding args drops the hook's default, so --no-progress is repeated here.
|
||||||
|
- repo: https://github.com/zizmorcore/zizmor-pre-commit
|
||||||
|
rev: 06a39750ec31860bb44f2acf67182c40016cd1e7 # frozen: v1.32.0
|
||||||
|
hooks:
|
||||||
|
- id: zizmor
|
||||||
|
args: [--no-progress, --offline]
|
||||||
|
files: ^\.gitea/workflows/[^/]+\.ya?ml$
|
||||||
|
stages: ['pre-commit']
|
||||||
|
|
||||||
# ansible-lint and the changelog lint run from PATH (language: system): their
|
# ansible-lint and the changelog lint run from PATH (language: system): their
|
||||||
# versions are the pins in requirements-dev.txt, installed into a virtualenv by
|
# versions are the pins in requirements-dev.txt, installed into a virtualenv by
|
||||||
# CI and locally. ansible-lint is the slowest hook, so fail_fast stops the run
|
# CI and locally. ansible-lint is the slowest hook, so fail_fast stops the run
|
||||||
# once it fails (a global fail_fast would hide every other failure).
|
# once it fails (a global fail_fast would hide every other failure).
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
# REUSE compliance (licence files, SPDX data, REUSE.toml; docs/licensing.md in the
|
# REUSE compliance (licence files, SPDX data, REUSE.toml). The wrapper tolerates only
|
||||||
# environment repo). The wrapper tolerates only unused licence texts, see its docstring.
|
# unused licence texts, see its docstring.
|
||||||
- id: reuse-lint
|
- id: reuse-lint
|
||||||
name: REUSE compliance
|
name: REUSE compliance
|
||||||
description: reuse lint, tolerating unused licence texts until the roles arrive
|
description: reuse lint, tolerating unused licence texts until the roles arrive
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ Guidance for Claude Code (claude.ai/code) in this repository.
|
|||||||
|
|
||||||
## What this is
|
## What this is
|
||||||
|
|
||||||
`mortis.kamino`: an Ansible Collection (GPL-3.0-or-later, REUSE-compliant), extracted role by
|
`mortis.kamino`: an Ansible Collection (GPL-3.0-or-later, REUSE-compliant) of reusable,
|
||||||
role from the author's homelab environment repository. The design contract is ADR 0004 (in the
|
hardened roles. 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.
|
||||||
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
|
**Roadmap.** The roles still to come, and the ones that will never be extracted, are listed in
|
||||||
the README section "Roadmap". Context: the maintainer's private environment repository (a
|
the README section "Roadmap". Context: the maintainer's private environment repository (a
|
||||||
@@ -39,6 +38,13 @@ or create tags: those are the operator's.
|
|||||||
hook run builds the Go hook environments and takes minutes: run commits in the background.
|
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
|
`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.
|
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`.
|
- 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.
|
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.
|
- Conventional Commits. A PR says what was verified and what was not.
|
||||||
@@ -128,8 +134,8 @@ Single-context: `GLOSSARY.md` and `docs/adr/` at the root, both created lazily.
|
|||||||
## Dependency automation (Renovate)
|
## Dependency automation (Renovate)
|
||||||
|
|
||||||
`renovate.json` is run by `.gitea/workflows/renovate.yml` (daily cron and `workflow_dispatch`) on the
|
`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
|
`kamino-docker` runner, as a Kamino-only bot user: this repository's jobs run only on its own
|
||||||
maintainer's production environment. Never reuse another Renovate credential here.
|
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.
|
- **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`
|
A new Ubuntu release is a deliberate edit, never a bump. The `job_image` of each matrix entry in `image.yml`
|
||||||
@@ -164,8 +170,8 @@ maintainer's production environment. Never reuse another Renovate credential her
|
|||||||
constrains the bot's own pull requests.
|
constrains the bot's own pull requests.
|
||||||
- **No Collection release from tooling bumps:** tooling files are in `galaxy.yml` `build_ignore`. A
|
- **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.
|
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`
|
- **Denied image namespace:** `check_image_versions.py pins` fails when anything under `.gitea/workflows`
|
||||||
mentions the maintainer's production image namespace.
|
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
|
- **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.
|
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.
|
- **The runner has a single slot:** the Renovate job (up to 30 minutes) delays Lint, Build and Molecule.
|
||||||
|
|||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
# Gate files: once branch protection requires code-owner approval, a change to any of
|
||||||
|
# them waits for the maintainer's. Gitea reads this root file before docs/ and .gitea/, so no other CODEOWNERS shadows it.
|
||||||
|
# Patterns are regular expressions anchored at both ends, not globs. Gitea drops one
|
||||||
|
# backslash before compiling, so a literal dot is written \\. (a bare \. would match any
|
||||||
|
# character). Gitea skips a line that does not compile and never reports a pattern that
|
||||||
|
# matches nothing.
|
||||||
|
# One owner on purpose: every matching rule needs its own owner's approval.
|
||||||
|
# Some patterns name paths that do not exist yet, so the file is in place before they do.
|
||||||
|
# Everything else is unowned, so role changes merge on green checks. requirements-dev.txt,
|
||||||
|
# requirements-dev.lock and requirements.yml stay unowned on purpose, so Renovate's pin
|
||||||
|
# bumps keep automerging behind the bot-diff gate.
|
||||||
|
|
||||||
|
CODEOWNERS @Defame1297
|
||||||
|
\\.gitea/.* @Defame1297
|
||||||
|
scripts/.* @Defame1297
|
||||||
|
images/.* @Defame1297
|
||||||
|
tests/scripts/.* @Defame1297
|
||||||
|
tests/sanity/ignore-.*\\.txt @Defame1297
|
||||||
|
renovate\\.json @Defame1297
|
||||||
|
\\.pre-commit-config\\.yaml @Defame1297
|
||||||
|
\\.ansible-lint(-ignore)? @Defame1297
|
||||||
|
\\.yamllint @Defame1297
|
||||||
|
ruff\\.toml @Defame1297
|
||||||
|
REUSE\\.toml @Defame1297
|
||||||
|
changelogs/config\\.yaml @Defame1297
|
||||||
|
galaxy\\.yml @Defame1297
|
||||||
|
docs/adr/.* @Defame1297
|
||||||
|
docs/contributing/.* @Defame1297
|
||||||
|
docs/agents/.* @Defame1297
|
||||||
|
CONTRIBUTING\\.md @Defame1297
|
||||||
|
SECURITY\\.md @Defame1297
|
||||||
|
GLOSSARY\\.md @Defame1297
|
||||||
|
(.*/)?AGENTS\\.md @Defame1297
|
||||||
|
\\.claude/.* @Defame1297
|
||||||
|
apm\\.yml @Defame1297
|
||||||
|
apm\\.lock\\.yaml @Defame1297
|
||||||
|
\\.mcp\\.json @Defame1297
|
||||||
+10
-7
@@ -2,10 +2,14 @@
|
|||||||
|
|
||||||
- Open a pull request against `main`. The forge does not allow self-registration, so only
|
- 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
|
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
|
pull requests are not a supported path: a fork controls its own workflow file. Workflows on fork pull requests get
|
||||||
showed workflows starting without an approval step. Workflows on fork pull requests get
|
|
||||||
no secrets and a read-only token. To discuss a contribution, write to the address in
|
no secrets and a read-only token. To discuss a contribution, write to the address in
|
||||||
`SECURITY.md`.
|
`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/)
|
- Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
|
||||||
(`feat:`, `fix:`, `docs:`, `ci:` ...). CI checks every commit.
|
(`feat:`, `fix:`, `docs:`, `ci:` ...). CI checks every commit.
|
||||||
- Every user-visible change needs a changelog fragment in `changelogs/fragments/`
|
- Every user-visible change needs a changelog fragment in `changelogs/fragments/`
|
||||||
@@ -49,14 +53,14 @@
|
|||||||
bumps the version and tags.
|
bumps the version and tags.
|
||||||
- `renovate.json` configures dependency bumps (minor and patch automerge, majors by hand). Renovate
|
- `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
|
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
|
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
|
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
|
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
|
(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.
|
`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
|
- Workflows must not mention `git.rkdr.net/defame1297/` (an image namespace this repository's
|
||||||
`Check image pins` step fails if they do.
|
CI must not use); the `Check image pins` step fails if they do.
|
||||||
|
|
||||||
## Maintainer setup
|
## Maintainer setup
|
||||||
|
|
||||||
@@ -68,8 +72,7 @@ outside contributions:
|
|||||||
- Protect `main`: pull request required, with the `Lint` and `Build` checks. Molecule has no path filter
|
- Protect `main`: pull request required, with the `Lint` and `Build` checks. Molecule has no path filter
|
||||||
on pull requests (the job always starts and chooses its scenarios itself), so it can be made a required
|
on pull requests (the job always starts and chooses its scenarios itself), so it can be made a required
|
||||||
check as well; that is the operator's decision.
|
check as well; that is the operator's decision.
|
||||||
- The image workflow (`.gitea/workflows/image.yml`) tries the Actions job token first;
|
- The image workflow (`.gitea/workflows/image.yml`) pushes with the organisation secrets
|
||||||
Gitea 28 refuses it for an organisation's packages, so it pushes with the organisation secrets
|
|
||||||
`PACKAGE_PUSH_USER` and `PACKAGE_PUSH_TOKEN` (a bot user with write access to the
|
`PACKAGE_PUSH_USER` and `PACKAGE_PUSH_TOKEN` (a bot user with write access to the
|
||||||
organisation's packages and a token with only the `write:package` scope). Keep
|
organisation's packages and a token with only the `write:package` scope). Keep
|
||||||
those the only credentials stored at organisation level.
|
those the only credentials stored at organisation level.
|
||||||
+1
-1
@@ -11,7 +11,7 @@ SPDX-FileCopyrightText = "Defame1297 and contributors"
|
|||||||
SPDX-License-Identifier = "GPL-3.0-or-later"
|
SPDX-License-Identifier = "GPL-3.0-or-later"
|
||||||
|
|
||||||
# Third-party-derived content, so files without a header do not fall back to the
|
# 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.
|
# wins over the default and over any header. Later entries win over earlier ones.
|
||||||
# These paths arrive with their roles (wave 1 and 2).
|
# These paths arrive with their roles (wave 1 and 2).
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ license: GPL-3.0-or-later
|
|||||||
|
|
||||||
# Consumer side: holocron plugins are addressed as git+path objects rather than
|
# Consumer side: holocron plugins are addressed as git+path objects rather than
|
||||||
# <name>@holocron marketplace aliases, so nothing outside this manifest is
|
# <name>@holocron marketplace aliases, so nothing outside this manifest is
|
||||||
# needed. Unpinned (default branch) on purpose, matching ../ansible and
|
# needed. Unpinned (default branch) on purpose: Renovate cannot keep a pin
|
||||||
# ../ai-development: Renovate cannot keep a pin current here. Its apm manager
|
# current here. Its apm manager documents only the string form (not these
|
||||||
# documents only the string form (not these git+path objects), is not in
|
# git+path objects), is not in
|
||||||
# renovate.json's enabledManagers, and holocron's v* tags are repo-wide and
|
# 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
|
# 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
|
# hand-kept ref would just go stale. The third-party skills are pinned inside
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ How the engineering skills should consume this repo's domain documentation when
|
|||||||
- **`GLOSSARY-MAP.md`** at the repo root if it exists: it points at one `GLOSSARY.md` per context. Read each one relevant to the topic.
|
- **`GLOSSARY-MAP.md`** at the repo root if it exists: it points at one `GLOSSARY.md` per context. Read each one relevant to the topic.
|
||||||
- **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src/<context>/docs/adr/` for context-scoped decisions.
|
- **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src/<context>/docs/adr/` for context-scoped decisions.
|
||||||
|
|
||||||
Kamino's design contract is ADR 0004, kept in the maintainer's environment repository, not in this checkout. `docs/adr/` here holds only decisions made in this repository and may not exist yet.
|
`docs/adr/` holds this repository's decisions and may not exist yet.
|
||||||
|
|
||||||
If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved.
|
If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ Ubuntu 26.04 with:
|
|||||||
`requirements.yml`: `community.general` and `ansible.posix` at the exact versions CI tests against, so
|
`requirements.yml`: `community.general` and `ansible.posix` at the exact versions CI tests against, so
|
||||||
`ansible-lint --offline` resolves their modules instead of mocking them.
|
`ansible-lint --offline` resolves their modules instead of mocking them.
|
||||||
- **Every pre-commit hook environment** of `.pre-commit-config.yaml` in `/opt/pre-commit`
|
- **Every pre-commit hook environment** of `.pre-commit-config.yaml` in `/opt/pre-commit`
|
||||||
(`PRE_COMMIT_HOME`): conventional-pre-commit, gitleaks, yamllint, ruff, shellcheck-py, pre-commit-hooks and actionlint. The Go
|
(`PRE_COMMIT_HOME`): conventional-pre-commit, gitleaks, yamllint, ruff, shellcheck-py, pre-commit-hooks, actionlint and zizmor. The Go
|
||||||
hooks are prebuilt; their toolchains, and the binaries of those repositories that no hook runs, are removed to
|
hooks are prebuilt; their toolchains, and the binaries of those repositories that no hook runs, are removed to
|
||||||
keep layers small. The local hooks (`reuse-lint`,
|
keep layers small. The local hooks (`reuse-lint`,
|
||||||
`antsibull-changelog-lint`, `ansible-lint`) are `language: system`: they run from `/opt/venv`, which is why
|
`antsibull-changelog-lint`, `ansible-lint`) are `language: system`: they run from `/opt/venv`, which is why
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
A disposable **Ubuntu 24.04** test target for the molecule scenarios of the
|
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
|
[`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.
|
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
|
## What is in it
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ build_ignore:
|
|||||||
- .ansible-lint
|
- .ansible-lint
|
||||||
- .ansible-lint-ignore
|
- .ansible-lint-ignore
|
||||||
- CLAUDE.md
|
- CLAUDE.md
|
||||||
|
- CODEOWNERS
|
||||||
- CONTRIBUTING.md
|
- CONTRIBUTING.md
|
||||||
- GLOSSARY.md
|
- GLOSSARY.md
|
||||||
- SECURITY.md
|
- SECURITY.md
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ COPY requirements-dev.txt requirements-dev.lock requirements.yml .pre-commit-con
|
|||||||
# uv only lives in the build stage (its own venv): the final image keeps the interpreters it
|
# uv only lives in the build stage (its own venv): the final image keeps the interpreters it
|
||||||
# downloaded, not the installer. The distribution's python3 only bootstraps uv.
|
# downloaded, not the installer. The distribution's python3 only bootstraps uv.
|
||||||
RUN python3 -m venv /opt/uv-venv \
|
RUN python3 -m venv /opt/uv-venv \
|
||||||
&& /opt/uv-venv/bin/pip install uv==0.13.8 \
|
&& /opt/uv-venv/bin/pip install uv==0.13.9 \
|
||||||
&& /opt/uv-venv/bin/uv python install 3.11 3.13 ${PYTHON_VERSION}
|
&& /opt/uv-venv/bin/uv python install 3.11 3.13 ${PYTHON_VERSION}
|
||||||
|
|
||||||
# python-build-standalone ships lib/libpython<MINOR>.so (about 33 MB, 10 MB compressed) next to a statically
|
# python-build-standalone ships lib/libpython<MINOR>.so (about 33 MB, 10 MB compressed) next to a statically
|
||||||
@@ -118,7 +118,8 @@ RUN ANSIBLE_COLLECTIONS_PATH=/opt/collections \
|
|||||||
# environments fit: with them the layer was about 103 MB compressed and the push of
|
# environments fit: with them the layer was about 103 MB compressed and the push of
|
||||||
# ci 0.2.16 got a 413. The hooks below run on a staged sample before and after the
|
# ci 0.2.16 got a 413. The hooks below run on a staged sample before and after the
|
||||||
# deletion: a cache that is incomplete (a missing environment would be rebuilt, which
|
# deletion: a cache that is incomplete (a missing environment would be rebuilt, which
|
||||||
# needs the network) or no longer works fails the image build, not the jobs.
|
# needs the network) or no longer works fails the image build, not the jobs. The sample
|
||||||
|
# workflow sets `permissions: {}` because zizmor flags a workflow that leaves them default.
|
||||||
#
|
#
|
||||||
# The last lines print the compressed size of each directory a later COPY turns into a
|
# The last lines print the compressed size of each directory a later COPY turns into a
|
||||||
# layer, which is what the 100 MB (95 MiB) limit applies to. These gzip -6 figures run
|
# layer, which is what the 100 MB (95 MiB) limit applies to. These gzip -6 figures run
|
||||||
@@ -135,9 +136,9 @@ RUN set -eu; \
|
|||||||
printf -- 'print("ok")\n' > ok.py; \
|
printf -- 'print("ok")\n' > ok.py; \
|
||||||
printf -- '#!/bin/sh\necho ok\n' > ok.sh; \
|
printf -- '#!/bin/sh\necho ok\n' > ok.sh; \
|
||||||
printf -- '---\nself-hosted-runner:\n labels:\n - kamino-docker\n' > .gitea/actionlint.yaml; \
|
printf -- '---\nself-hosted-runner:\n labels:\n - kamino-docker\n' > .gitea/actionlint.yaml; \
|
||||||
printf -- '---\n"on": push\njobs:\n t:\n runs-on: kamino-docker\n steps:\n - run: echo ok\n' > .gitea/workflows/t.yml; \
|
printf -- '---\n"on": push\npermissions: {}\njobs:\n t:\n runs-on: kamino-docker\n steps:\n - run: echo ok\n' > .gitea/workflows/t.yml; \
|
||||||
git add ok.yaml ok.py ok.sh .gitea/actionlint.yaml .gitea/workflows/t.yml; \
|
git add ok.yaml ok.py ok.sh .gitea/actionlint.yaml .gitea/workflows/t.yml; \
|
||||||
smoke() { for h in yamllint gitleaks actionlint ruff-check ruff-format shellcheck; do /opt/venv/bin/pre-commit run "$h" --all-files; done; }; \
|
smoke() { for h in yamllint gitleaks actionlint zizmor ruff-check ruff-format shellcheck; do /opt/venv/bin/pre-commit run "$h" --all-files; done; }; \
|
||||||
smoke; \
|
smoke; \
|
||||||
rm -rf /opt/pre-commit/repo*/golangenv-*/.go /root/.cache/go-build; \
|
rm -rf /opt/pre-commit/repo*/golangenv-*/.go /root/.cache/go-build; \
|
||||||
find /opt/pre-commit/repo*/golangenv-*/bin -mindepth 1 -maxdepth 1 -type f \
|
find /opt/pre-commit/repo*/golangenv-*/bin -mindepth 1 -maxdepth 1 -type f \
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# ansible-core 2.19 is what the environment repo's CI image pins
|
# The roles were written against ansible-core 2.19 and nothing older has been
|
||||||
# (ci_python_tool_ansible_core_version). Raise this when a role needs a newer
|
# tested. Raise this when a role needs a newer core; lowering it needs the molecule and
|
||||||
# core; lowering it needs the molecule and sanity runs on the older core first.
|
# sanity runs on the older core first.
|
||||||
requires_ansible: ">=2.19.0"
|
requires_ansible: ">=2.19.0"
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$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": [
|
"extends": [
|
||||||
"config:recommended",
|
"config:recommended",
|
||||||
":enablePreCommit"
|
":enablePreCommit"
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# package too, with the sha256 of each release file) and is what gets installed; pip refuses an
|
# 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
|
# 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).
|
# (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 (renovate.json) bumps these pins; a bump rebuilds the ci image (images/ci) and
|
||||||
# Renovate then moves the consumers' pins to it.
|
# Renovate then moves the consumers' pins to it.
|
||||||
ansible-core==2.22.0
|
ansible-core==2.22.0
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: Defame1297 and contributors
|
# SPDX-FileCopyrightText: Defame1297 and contributors
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
"""Bump the PATCH version of every image whose inputs changed (ADR 0004, Image distribution, in the
|
"""Bump the PATCH version of every image whose inputs changed.
|
||||||
maintainer's environment repository).
|
|
||||||
|
|
||||||
python3 scripts/bump_image_versions.py [<base-ref>] (default: origin/main)
|
python3 scripts/bump_image_versions.py [<base-ref>] (default: origin/main)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: Defame1297 and contributors
|
# SPDX-FileCopyrightText: Defame1297 and contributors
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
"""Keep image versions and image pins honest (ADR 0004, Image distribution, in the
|
"""Keep image versions and image pins honest.
|
||||||
maintainer's environment repository).
|
|
||||||
|
|
||||||
python3 scripts/check_image_versions.py pins
|
python3 scripts/check_image_versions.py pins
|
||||||
python3 scripts/check_image_versions.py bump <base-ref>
|
python3 scripts/check_image_versions.py bump <base-ref>
|
||||||
@@ -12,9 +11,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
|
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.
|
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
|
pins No file under .gitea/workflows may mention `git.rkdr.net/defame1297/`: an image
|
||||||
image set of the environment repo never belongs in this CI (the `mortis` side is the
|
namespace this repository's CI must not use.
|
||||||
untrusted one, ADR 0004 Runner isolation).
|
|
||||||
Every `git.rkdr.net/mortis/<name>:<version>@sha256:<digest>` in the consumer
|
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
|
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
|
version that is not newer than the matrix (a pin lags the matrix between the PR
|
||||||
@@ -80,7 +78,7 @@ ANY_PIN_RE = re.compile(
|
|||||||
r"""(?:[:@][^\s,)\]}'"]*)?""",
|
r"""(?:[:@][^\s,)\]}'"]*)?""",
|
||||||
re.IGNORECASE,
|
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)
|
FOREIGN_RE = re.compile(r"git\.rkdr\.net(?::[0-9]+)?/defame1297/", re.IGNORECASE)
|
||||||
WORKFLOW_DIR = ".gitea/workflows"
|
WORKFLOW_DIR = ".gitea/workflows"
|
||||||
# Semver 2.0.0: no leading zeros in numeric identifiers (core or prerelease).
|
# Semver 2.0.0: no leading zeros in numeric identifiers (core or prerelease).
|
||||||
@@ -644,10 +642,10 @@ def changed_images(head_matrix, changed, read_head_file):
|
|||||||
|
|
||||||
|
|
||||||
def check_foreign_images(workflow_texts):
|
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 [
|
return [
|
||||||
f"{fname}: mentions git.rkdr.net/defame1297/, the production image set; the Collection's CI "
|
f"{fname}: mentions git.rkdr.net/defame1297/, an image namespace this repository's CI "
|
||||||
"must never use or name it"
|
"must not use or name"
|
||||||
for fname, text in sorted(workflow_texts.items())
|
for fname, text in sorted(workflow_texts.items())
|
||||||
if FOREIGN_RE.search(text)
|
if FOREIGN_RE.search(text)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
"""Run `reuse lint`, tolerating only unused licence texts.
|
"""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
|
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
|
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.
|
in files for all of them, delete UNUSED_ALLOWED and call `reuse lint` directly.
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ IGNORED = (
|
|||||||
"SECURITY.md",
|
"SECURITY.md",
|
||||||
"GLOSSARY.md",
|
"GLOSSARY.md",
|
||||||
"CLAUDE.md",
|
"CLAUDE.md",
|
||||||
|
"CODEOWNERS",
|
||||||
"CHANGELOG.rst",
|
"CHANGELOG.rst",
|
||||||
"COPYING",
|
"COPYING",
|
||||||
"NOTICE",
|
"NOTICE",
|
||||||
|
|||||||
@@ -319,6 +319,14 @@ class RuleTest(unittest.TestCase):
|
|||||||
cbd.file_problem(".pre-commit-config.yaml", [" rev: a"], [])
|
cbd.file_problem(".pre-commit-config.yaml", [" rev: a"], [])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_a_bump_of_the_real_zizmor_rev_line_is_allowed(self):
|
||||||
|
# The line as Renovate's git-tags lookup finds it in this repository's config.
|
||||||
|
config = (SCRIPTS.parent / ".pre-commit-config.yaml").read_text().splitlines()
|
||||||
|
repo = config.index(" - repo: https://github.com/zizmorcore/zizmor-pre-commit")
|
||||||
|
rev = config[repo + 1]
|
||||||
|
bumped = f" rev: {'f' * 40} # frozen: v99.0.0"
|
||||||
|
self.assertIsNone(cbd.file_problem(".pre-commit-config.yaml", [rev], [bumped]))
|
||||||
|
|
||||||
def test_patch_parser_keeps_dashed_content(self):
|
def test_patch_parser_keeps_dashed_content(self):
|
||||||
patch = "diff --git a/f b/f\n--- a/f\n+++ b/f\n@@ -1 +1 @@\n--- x\n+++ y\n\\ No newline at end of file\n"
|
patch = "diff --git a/f b/f\n--- a/f\n+++ b/f\n@@ -1 +1 @@\n--- x\n+++ y\n\\ No newline at end of file\n"
|
||||||
self.assertEqual(cbd.parse_patch(patch), (["-- x"], ["++ y"]))
|
self.assertEqual(cbd.parse_patch(patch), (["-- x"], ["++ y"]))
|
||||||
|
|||||||
@@ -129,9 +129,9 @@ class PureTest(unittest.TestCase):
|
|||||||
def matrix(self, mol="0.1.0", ci="0.2.0"):
|
def matrix(self, mol="0.1.0", ci="0.2.0"):
|
||||||
return civ.matrix_of(IMAGE_YML.format(mol=mol, ci=ci))
|
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 (
|
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",
|
"# GIT.RKDR.NET:443/Defame1297/x",
|
||||||
"image: git.rkdr.net/defame1297/y",
|
"image: git.rkdr.net/defame1297/y",
|
||||||
):
|
):
|
||||||
@@ -139,10 +139,20 @@ class PureTest(unittest.TestCase):
|
|||||||
for text in (
|
for text in (
|
||||||
"image: git.rkdr.net/mortis/ci:0.2.0",
|
"image: git.rkdr.net/mortis/ci:0.2.0",
|
||||||
"https://git.rkdr.net/defame1297x",
|
"https://git.rkdr.net/defame1297x",
|
||||||
"see Defame1297/ansible-homelab-mono",
|
"see Defame1297/some-repository",
|
||||||
):
|
):
|
||||||
self.assertEqual(civ.check_foreign_images({"w.yml": text}), [], text)
|
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):
|
def test_pins_ok_and_lagging(self):
|
||||||
pin = f"image: git.rkdr.net/mortis/ci:0.1.0@{DIGEST}\n"
|
pin = f"image: git.rkdr.net/mortis/ci:0.1.0@{DIGEST}\n"
|
||||||
self.assertEqual(civ.check_pins(self.matrix(), {"lint.yml": pin}), [])
|
self.assertEqual(civ.check_pins(self.matrix(), {"lint.yml": pin}), [])
|
||||||
@@ -717,7 +727,7 @@ class GitTest(unittest.TestCase):
|
|||||||
self.assertIn(text, err)
|
self.assertIn(text, err)
|
||||||
self.assertEqual(len(err.strip().splitlines()), 1, 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.write(".gitea/workflows/lint.yml", "name: Lint\n")
|
||||||
self.assertEqual(self.bump_args("pins")[0], 0)
|
self.assertEqual(self.bump_args("pins")[0], 0)
|
||||||
self.write(
|
self.write(
|
||||||
|
|||||||
Reference in new issue
Block a user