Compare commits

..
Author SHA1 Message Date
Defame1297 5e230201e6 Merge branch 'main' into docs/adr-molecule-controller-image
Lint / lint (pull_request) In progress
Build / build (pull_request) Successful in 29s
Molecule / molecule (pull_request) Successful in 5s
2026-11-27 16:05:04 +00:00
Defame1297 114a21fc0f Merge pull request 'docs: update a branch from main only when it is next to merge' (#436) from docs/branch-update-rule into main
Reviewed-on: #436
Reviewed-by: Defame1297 <[email protected]>
2026-11-27 16:04:44 +00:00
Defame1297 c33da78633 Merge branch 'main' into docs/branch-update-rule
Build / build (pull_request) Successful in 29s
Molecule / molecule (pull_request) Successful in 7s
Lint / lint (pull_request) Successful in 1m33s
2026-11-27 16:03:01 +00:00
Defame1297 7dbf9a1bd0 Merge pull request 'ci(renovate): group updates and open them on Mondays' (#438) from ci/renovate-group-schedule into main
Reviewed-on: #438
2026-11-27 16:02:48 +00:00
Defame1297 6c031acc26 Merge branch 'main' into ci/renovate-group-schedule
Build / build (pull_request) Successful in 31s
Molecule / molecule (pull_request) Successful in 4s
Lint / lint (pull_request) Successful in 1m36s
2026-11-27 15:59:47 +00:00
Defame1297 16b1aa4136 ci(renovate): group updates and open them on Mondays
Build / build (pull_request) Successful in 23s
Molecule / molecule (pull_request) Successful in 1m13s
Lint / lint (pull_request) Successful in 2m11s
Updates, lock file maintenance included, open on Mondays (UTC) so any
Monday run can act, with no hourly pull request limit; the weekly window
and the groups bound the volume. Groups: own CI images (ci and both
molecule pins, exempt from the schedule), ubuntu base images (Dockerfile
FROM and image.yml job_image digests in one branch, so manual), lint
tooling and pre-commit hooks. osvVulnerabilityAlerts brings fixes from
osv.dev; they skip the schedule and the release-age wait, so
vulnerabilityAlerts.automerge false keeps a person on each one.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 14:25:23 +00:00
Defame1297 e4eb3bc656 Merge branch 'main' into docs/branch-update-rule
Build / build (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 7s
Lint / lint (pull_request) Successful in 1m29s
2026-11-27 14:09:00 +00:00
Defame1297 15c3731e7f Merge pull request 'chore(deps): update git.rkdr.net/mortis/ci docker tag to v0.2.47' (#416) from renovate/git.rkdr.net-mortis-ci-0.x into main
Reviewed-on: #416
Reviewed-by: Defame1297 <[email protected]>
2026-11-27 14:02:47 +00:00
Defame1297 04259751ad docs(adr): point ADR 0002 to ADR 0003 and sharpen 0003
Build / build (pull_request) Successful in 51s
Lint / lint (pull_request) Canceled after 50s
Molecule / molecule (pull_request) Canceled after 8s
ADR 0002's image bullet now names ADR 0003 as the decision that adds
Molecule's controller image; its decision is unchanged. ADR 0003 states
the Lint-only share of ci pin pull requests as a count and lists the
push paths of image.yml among the files the implementation updates.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 13:50:55 +00:00
Defame1297 699179674f docs: bring a renovate/ branch up to date through its rebase checkbox
Build / build (pull_request) Successful in 1m19s
Lint / lint (pull_request) Successful in 3m38s
Molecule / molecule (pull_request) Successful in 2m37s
A Renovate pull request is not always rebased just for falling
behind main, so forbidding every update would leave it stuck. Never
use the update button on it; tick the rebase/retry checkbox instead,
and say why a hand-made update commit is excluded.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 13:45:55 +00:00
Defame1297 bf604a1af2 docs(adr): run Molecule in its own controller image
Record ADR 0003: Molecule runs in a molecule-controller image that bakes
only Molecule's tools, from a requirements file and hash-pinned lock of
its own, so a ci pin pull request no longer moves molecule.yml and runs
no scenario. The ADR lists the files the implementation updates and the
alternatives not taken.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 13:38:09 +00:00
Defame1297 3d2fab5388 docs: update a branch from main only when it is next to merge
main blocks an outdated branch, so every update re-runs Lint, Build
and Molecule and cancels the run in progress. Limit updates to the
pull request that is next to merge, schedule its merge afterwards,
and leave renovate/ branches to Renovate's own rebase.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 13:37:49 +00:00
renovate-bot 042051b3e5 chore(deps): update git.rkdr.net/mortis/ci docker tag to v0.2.48
renovate/stability-days Updates have met minimum release age requirement
Gitea release key / check (pull_request) Successful in 24s
Build / build (pull_request) Successful in 1m28s
Lint / lint (pull_request) Successful in 2m13s
Molecule / molecule (pull_request) Successful in 57m8s
2026-11-27 13:02:52 +00:00
17 changed files with 144 additions and 131 deletions

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
timeout-minutes: 30
# The ci image (images/ci, built by image.yml): tag for the release, digest enforced.
container:
image: git.rkdr.net/mortis/ci:0.2.46@sha256:a03015cc2177bdd6ef7f348f245a89f361893c7c64edc1264d9f9c1387d9defc
image: git.rkdr.net/mortis/ci:0.2.48@sha256:d1c6653255abf366462c0265d9372626d5b59095084fe74ae95b9ebe7414007d
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
steps:
+1 -1
View File
@@ -44,7 +44,7 @@ jobs:
# The ci image (images/ci, built by image.yml), at the pin of lint.yml: tag for the
# release, digest enforced. Only its /opt/venv Python (with PyYAML) is used here.
container:
image: git.rkdr.net/mortis/ci:0.2.46@sha256:a03015cc2177bdd6ef7f348f245a89f361893c7c64edc1264d9f9c1387d9defc
image: git.rkdr.net/mortis/ci:0.2.48@sha256:d1c6653255abf366462c0265d9372626d5b59095084fe74ae95b9ebe7414007d
steps:
# The container has no Node, so JavaScript actions such as actions/checkout
# cannot run; clone with git and the job token.
+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
# The tag says which release, the digest is what is enforced (bump both together
# when image.yml publishes a new version).
container:
image: git.rkdr.net/mortis/ci:0.2.46@sha256:a03015cc2177bdd6ef7f348f245a89f361893c7c64edc1264d9f9c1387d9defc
image: git.rkdr.net/mortis/ci:0.2.48@sha256:d1c6653255abf366462c0265d9372626d5b59095084fe74ae95b9ebe7414007d
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PRE_COMMIT_HOME: /opt/pre-commit
+1 -1
View File
@@ -53,7 +53,7 @@ jobs:
env:
# The tools and collections molecule runs with: the image Lint and Build use.
CI_IMAGE: >-
git.rkdr.net/mortis/ci:0.2.46@sha256:a03015cc2177bdd6ef7f348f245a89f361893c7c64edc1264d9f9c1387d9defc
git.rkdr.net/mortis/ci:0.2.48@sha256:d1c6653255abf366462c0265d9372626d5b59095084fe74ae95b9ebe7414007d
# Used by the scenarios as `image: ${MOLECULE_IMAGE}`; set it the same way to run
# one locally.
MOLECULE_IMAGE: >-
@@ -1,5 +0,0 @@
---
minor_changes:
- >-
traefik - New input ``traefik_release_url`` sets where the release archive and checksums are
downloaded from, for a mirror (default: the GitHub releases, as before).
@@ -12,6 +12,7 @@ and pin updates. The choice is hard to undo once every workflow pins an image.
- **We build our own images:** a `ci` image, and one Dockerfile per molecule image (one per Ubuntu
release, and later the Debian 13 one).
Molecule's controller image is added by [ADR 0003](0003-molecule-controller-image.md).
- **The molecule images bake in everything except what a role installs itself.** The test
fixtures a scenario's `prepare.yml` needs are baked in. Packages a role installs are still
downloaded, because that install path is what the test exercises. A converge is not kept off
@@ -0,0 +1,60 @@
# 0003. Molecule runs in its own controller image, not the `ci` image
Status: accepted
## Context
[ADR 0002](0002-self-built-ci-and-molecule-images.md) built one `ci` image that bakes every CI
tool, and Lint, Build and Molecule all pin it. A change to a tool only Lint uses (apm-cli,
antsibull-changelog, a pre-commit hook environment) publishes a new `ci` version, and its pin
pull request moves `CI_IMAGE` in `molecule.yml`. The scenario selector cannot tell what changed
inside an image, so it runs every scenario. 9 of 18 `ci` pin pull requests over two weeks
were Lint-only. Images are built only on push to `main`, so a bump and its pin never share a pull
request.
## Decision
- **Molecule runs in a `molecule-controller` image**, separate from `ci`. It bakes only what
Molecule needs: ansible-core, molecule, molecule-plugins, the Python packages of the Docker
connection, and the collections of `requirements.yml` and
`extensions/molecule/requirements.yml`.
- **Its Python packages come from a requirements file and hash-pinned lock of its own.**
- **`molecule.yml` pins it instead of `ci`**; Lint and Build keep `ci`.
- **It follows ADR 0002 otherwise:** built by `image.yml`, versioned by CI, pinned by
`<version>@sha256:<digest>`, moved by Renovate. This adds to ADR 0002's set of images; the
rest of ADR 0002 stands.
## Reason
A `ci` pin pull request then touches only paths the selector ignores and runs no scenario. A
`molecule-controller` pin pull request still runs every scenario, which is right: it changes
Molecule's tools.
The cost: one more image and lock to maintain, its layers to estimate against the 100 MB limit,
a hand-made first pin, and ansible-core pinned in two locks that must stay equal. A collection
bump is an input of both images, so it publishes two versions and two pin pull requests.
The controller's requirements file and lock must not be on the selector's IGNORED list, so a
bump of ansible-core or molecule there runs every scenario before it merges. Today
`requirements-dev.txt` and `requirements-dev.lock` are on IGNORED, so such a bump selects no
scenario unless it edits `meta/runtime.yml`; this decision does not change that list.
The implementation updates: `image.yml` (matrix, and its push `paths` unless the new files live
under `images/`), `molecule.yml`,
`scripts/run_molecule_in_ci_image.sh` (its pin comparison reads the `ci` image's checksums),
`scripts/check_image_versions.py`, `scripts/check_bot_pr_diff.py` and
`scripts/lock-requirements.sh` (they know only `requirements-dev.lock`), their tests, the
`pip-compile` patterns in `renovate.json`, `images/AGENTS.md` (the consumer list, and "each
molecule image is one Ubuntu release"), the Molecule rules in `.gitea/workflows/AGENTS.md`,
`docs/images/` (a new page, and `ci.md`, which names Molecule as a consumer), the `ci`
Dockerfile's description label, `docs/contributing/setup.md` if the clone's tools change, and the
[Accepted risks](../../SECURITY.md#accepted-risks) entry "Pin bumps first behaviour-tested after
they merge", which counts on the `ci` pin pull request running every scenario.
## Not done
- **The selector classifies the packages a lock change moves, to decide whether a `CI_IMAGE`
bump matters:** a heuristic package list inside a script that judges pull requests.
- **Status quo:** every Lint-only tool change keeps costing a full Molecule run.
- **Grouping pin pull requests only:** adopted separately; it lowers the number of full runs
but not the cause.
+14 -1
View File
@@ -15,10 +15,23 @@ trailers, are in [ai-assistance.md](ai-assistance.md).
*Reason:* every change reaches `main` through the Lint and Build checks and a reviewer.
*Held by:* control: branch protection on `main`.
- **Do not push to someone else's branch or to a bot's branch; put your change in a pull request of
your own.** Updating a branch from `main` with Gitea's update button is allowed.
your own.** Updating a branch from `main` with Gitea's update button is allowed under the next
two rules.
*Reason:* a push changes a head its author already reviewed or scheduled to merge, and a hand-made
commit on a `renovate/` branch makes Renovate stop rebasing it.
*Held by:* aspirational.
- **Update a pull request's branch from `main` only when it is next to merge: reviewed, green on its
previous head, and the only branch being updated. After updating your own pull request, give it a
scheduled merge; merge anyone else's as [reviewing.md](reviewing.md) says.**
*Reason:* `main` blocks an outdated branch, so every update re-runs Lint, Build and Molecule, and
a new head cancels the run in progress; an update made while another pull request merges first is
wasted.
*Held by:* aspirational.
- **Never press the update button on a `renovate/` branch. When a Renovate pull request is next to
merge and behind `main`, tick the rebase/retry checkbox in its description; Renovate rebases it at
its next run.**
*Reason:* the update button adds a hand-made commit, and Renovate stops rebasing that branch.
*Held by:* aspirational.
- **File an issue or open a pull request with the headings of the matching template in `.gitea/`,
also when you file through the API, `tea` or an MCP server.**
*Reason:* those routes skip the templates, and an agent's built-in body leaves out what review needs.
+48 -9
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"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. Image versions are assigned by the Images workflow when an image's inputs change, so a bot pull request needs no version edit.",
"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. Image versions are assigned by the Images workflow when an image's inputs change, so a bot pull request needs no version edit. Updates open on Mondays (UTC), so any Monday run can act; the own image pins and vulnerability fixes found on osv.dev open at any time. The weekly window and the groups bound the volume, so there is no hourly pull request limit. Vulnerability fixes skip the release-age wait, so they are never automerged: a person checks a fix that had no time to be pulled as a compromised release. Base-image bumps are manual: every Dockerfile is FROM ubuntu, grouped with the job containers.",
"extends": [
"config:recommended",
":enablePreCommit"
@@ -19,7 +19,7 @@
],
"automerge": true,
"automergeType": "pr",
"prHourlyLimit": 5,
"prHourlyLimit": 0,
"minimumReleaseAge": "3 days",
"minimumReleaseAgeBehaviour": "timestamp-optional",
"timezone": "UTC",
@@ -90,7 +90,7 @@
],
"packageRules": [
{
"description": "Dockerfile base-image tag and digest bumps (images/*/Dockerfile) MAY automerge. Kamino is the untrusted side and the bump pull request's own CI exercises the new image before the merge. Placed first so the major-version rule below still turns automerge off. The merge publishes a new image version.",
"description": "Dockerfile base-image tag and digest bumps (images/*/Dockerfile) MAY automerge. Kamino is the untrusted side and the bump pull request's own CI exercises the new image before the merge. Placed first so the major-version rule below still turns automerge off. The merge publishes a new image version. Today every Dockerfile is FROM ubuntu, whose bumps join the manual ubuntu base images group below; this rule is the safety net for a future base image of another kind.",
"matchManagers": [
"dockerfile"
],
@@ -145,12 +145,18 @@
"allowedVersions": "<=26.10.1"
},
{
"description": "The job containers of image.yml (matrix job_image, ubuntu by digest) hold the org registry push credential while the image job runs: never automerged, and kept in their own branch so the Dockerfile base-image bumps are not held back with them.",
"description": "The job containers of image.yml (matrix job_image, ubuntu by digest) hold the org registry push credential while the image job runs: never automerged. Their ubuntu bumps share one branch with the Dockerfile FROM bumps (ubuntu base images rule below), so that pull request is manual too: a group automerges only if every update in it does.",
"matchFileNames": [
".gitea/workflows/image.yml"
],
"automerge": false,
"additionalBranchPrefix": "job-container-"
"automerge": false
},
{
"description": "The Dockerfile FROM digests and the image.yml job_image digests of one Ubuntu update move in one pull request, so the release pair stays in step and one Images run covers both.",
"matchPackageNames": [
"ubuntu"
],
"groupName": "ubuntu base images"
},
{
"description": "Safety net only: kaniko is pinned by layer digests in image.yml and no Renovate manager reads them, so it is updated by hand. If a manager ever starts to read it, its bumps are not automerged.",
@@ -160,11 +166,15 @@
"automerge": false
},
{
"description": "Pin follow-up for our own images (git.rkdr.net/mortis/*): moves the image:<version>@sha256:<digest> pins of lint.yml, build.yml, molecule.yml and gitea-release-key.yml to the newest published version and its digest, and automerges. The Images workflow's completion starts a Renovate run, so this pull request opens minutes after a new version is pushed. The pull request's own Lint and Build run in the new image before the merge, and scripts/check_bot_pr_diff.py allows only these pin lines. The registry lists tags and digests anonymously, so no hostRules are needed. A major version stays manual (rule above).",
"description": "Pin follow-up for our own images (git.rkdr.net/mortis/*): moves the image:<version>@sha256:<digest> pins of lint.yml, build.yml, molecule.yml and gitea-release-key.yml to the newest published version and its digest, and automerges. The Images workflow's completion starts a Renovate run, so this pull request opens minutes after a new version is pushed. The pull request's own Lint and Build run in the new image before the merge, and scripts/check_bot_pr_diff.py allows only these pin lines. The registry lists tags and digests anonymously, so no hostRules are needed. A major version stays manual (rule above). One pull request moves every image an Images run published (ci and both molecule images), so one Molecule run tests them together. Exempt from the weekly schedule, so the pins on main catch up with a new image within minutes.",
"matchPackageNames": [
"git.rkdr.net/mortis/**"
],
"automerge": true
"automerge": true,
"groupName": "own CI images",
"schedule": [
"at any time"
]
},
{
"description": "Look the pre-commit hook repositories up with git ls-remote (git-tags) instead of the GitHub API. This run has no GitHub token, and the github-tags datasource then either skips every hook (skipReason github-token-required, dry run 3880) or is refused at once with 403 rate limit (githubTokenWarn off, local run). git-tags needs no API and no credential, and it uses the dereferenced hash of an annotated tag, so the new rev is the commit, as pre-commit needs. The `# frozen:` form is kept by the manager's own replace template. It works only together with RENOVATE_GITHUB_TOKEN_WARN=false in renovate.yml: the token check runs after extraction and skips every github-tags dependency before a package rule can change its datasource (local run, Renovate 44.161.0). git-tags has no release timestamps, so minimumReleaseAge cannot delay a hook bump: hook bumps are never automerged, a person reviews each one.",
@@ -177,16 +187,45 @@
"overrideDatasource": "git-tags",
"overridePackageName": "https://github.com/{{{depName}}}",
"automerge": false
},
{
"description": "Lint and build tooling in one weekly pull request across requirements-dev.lock and the ci image's uv pin, so one ci image build instead of one per tool.",
"matchDatasources": [
"pypi"
],
"matchPackageNames": [
"apm-cli",
"antsibull-changelog",
"galaxy-importer",
"reuse",
"pre-commit",
"uv"
],
"groupName": "lint tooling"
},
{
"description": "The pre-commit hooks in one weekly pull request; never automerged (rule above).",
"matchManagers": [
"pre-commit"
],
"groupName": "pre-commit hooks"
}
],
"lockFileMaintenance": {
"enabled": true,
"schedule": [
"before 6am on monday"
"on monday"
],
"automerge": false,
"labels": [
"lock-file-maintenance"
]
},
"schedule": [
"on monday"
],
"osvVulnerabilityAlerts": true,
"vulnerabilityAlerts": {
"automerge": false
}
}
+2 -3
View File
@@ -30,7 +30,6 @@ The role targets Ubuntu hosts that run the reverse proxy, not Proxmox nodes, so
| `traefik_version` | pinned in `defaults/main.yml` | no | Release tag to install. |
| `traefik_arch` | `amd64` | no | Archive architecture. |
| `traefik_os` | `linux` | no | Archive OS. |
| `traefik_release_url` | github.com release directory of `traefik_version` | no | Directory URL of the archive and its checksums file, no trailing slash (templated). |
| `traefik_archive_name` | `traefik_<version>_<os>_<arch>.tar.gz` | no | Archive file name (templated). |
| `traefik_local_archive` | `/tmp/traefik.tar.gz` | no | Download destination, removed after extraction. |
| `traefik_bin_path` | `/usr/local/bin/traefik` | no | Binary path used by the unit and version checks; only the `traefik` file of the archive is extracted into its directory, so the file name must stay `traefik`. Only the `traefik` file is extracted, so the archive's `CHANGELOG.md` and `LICENSE.md` never land there. |
@@ -80,14 +79,14 @@ Update or remove: pass `-e traefik_update=true`, or `-e "traefik_remove=true tra
## Tests
The `default` molecule scenario runs in CI only, on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). It needs outbound network: the role installs packages with apt and the converge downloads the real Traefik release from GitHub. Converge runs `mortis.kamino.ufw`, then the role. It runs `check` before the converge (on a fresh host) and after it (on the configured host). Verify covers:
The `default` molecule scenario runs in CI only, on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). It needs outbound network: the role installs packages with apt and downloads real Traefik releases from GitHub. Converge runs `mortis.kamino.ufw`, then the role. It runs `check` before the converge (on a fresh host) and after it (on the configured host). Verify covers:
- The input guards, first: one play expects the failure message containing `unauthenticated Traefik dashboard` (the dashboard guard: enabled without valid `user:hash` users); the next expects `collides with the middleware`, raised by the dashboard-auth collision assert, which runs whenever users are set, also with the dashboard off.
- The install: the pinned version runs, and only the binary is left from the archive.
- Files: `traefik.env` mode 0600 owned by root, `dynamic.yml` mode 0600 owned by `traefik`, `traefik.yml` mode 0600, the binary mode 0755; the logrotate configuration, which `logrotate --debug` parses.
- Rendering: the ACME resolvers render when set and are absent when empty; the dashboard is off by default with the extra app routed, and renders behind basicAuth when enabled (a template render, not a running dashboard).
- The service: running and enabled with `NoNewPrivileges`, `MemoryDenyWriteExecute` and `CAP_NET_BIND_SERVICE`, listening on 80 and 443 and redirecting http to https; ufw allows 80 and 443 next to SSH, with the traefik owner tag, in order.
- The update path: it updates to another release and back with `traefik_update` (download from local `file://` stand-in releases, checksum check and swap) and asserts the version, an active unit and no leftovers. It leaves the stand-in stub installed, so nothing after it asserts real Traefik behaviour.
- The update path: it updates to another release and back with `traefik_update` (a real download, checksum check and swap) and asserts the version, an active unit and no leftovers.
- The remove path, last: unit and binary are deleted, the service is no longer active, and only the traefik ufw rules are removed.
The scenario disables the namespace-based sandboxing and the `User=` switch with a drop-in because its container is unprivileged, so that sandboxing is not covered by CI. Certificate issuance is not covered: the Cloudflare credentials are dummies.
-2
View File
@@ -9,8 +9,6 @@ traefik_version: "v3.7.19"
traefik_arch: "amd64"
traefik_os: "linux"
# Directory URL holding the release archive and its checksums file.
traefik_release_url: "https://github.com/traefik/traefik/releases/download/{{ traefik_version }}"
traefik_archive_name: "traefik_{{ traefik_version }}_{{ traefik_os }}_{{ traefik_arch }}.tar.gz"
traefik_local_archive: "/tmp/traefik.tar.gz"
-8
View File
@@ -63,14 +63,6 @@ argument_specs:
default: linux
description:
- Operating system part of the release archive name.
traefik_release_url:
type: raw
description:
- >-
URL of the directory holding the release archive and C(traefik_<traefik_version>_checksums.txt),
without a trailing slash. The role default is the Jinja expression
C(https://github.com/traefik/traefik/releases/download/<traefik_version>); point it at a mirror
for a host without access to github.com.
traefik_archive_name:
type: raw
description:
+2 -6
View File
@@ -2,9 +2,8 @@
# Runs on the repository's own runner (label kamino-molecule), in the molecule-ubuntu2404
# (MOLECULE_IMAGE) and molecule-ubuntu2604 (MOLECULE_IMAGE_2604) images, pinned in
# .gitea/workflows/molecule.yml. Needs outbound network, unlike most scenarios: the role installs
# packages with apt and the converge downloads the Traefik release from GitHub (verify's update
# path uses file:// stand-ins built by prepare.yml). No privileged mode: systemd needs a writable
# cgroup and the firewall tools need NET_ADMIN.
# packages with apt and downloads Traefik releases from GitHub. No privileged mode: systemd needs a
# writable cgroup and the firewall tools need NET_ADMIN.
driver:
name: docker
platforms:
@@ -55,9 +54,6 @@ provisioner:
traefik_cloudflare_email: [email protected]
traefik_cloudflare_api_token: molecule-not-a-token
traefik_domain: example.test
# Any release other than the role default: verify's update path goes there and back,
# from the stand-ins prepare.yml builds.
traefik_verify_other_version: v3.7.18
ufw_rules:
- {rule: allow, port: 22, proto: tcp, comment: ssh}
# TEST-NET-1 address: nothing answers, the value only has to render
@@ -40,55 +40,3 @@
ProtectKernelTunables=no
ReadWritePaths=
User=
# Stand-in releases for verify's update path, behind file:// URLs: the role's download, checksum
# check and swap run unchanged, without fetching two more real releases per host. The converge
# still downloads the real role default from GitHub.
- name: Prepare the stand-in releases
hosts: all
gather_facts: false
vars_files:
- ../../defaults/main.yml
tasks:
- name: Create a directory per stand-in release
ansible.builtin.file:
path: "/opt/molecule-download/{{ traefik_test_release }}"
state: directory
mode: "0755"
loop: ["{{ traefik_verify_other_version }}", "{{ traefik_version }}"]
loop_control:
loop_var: traefik_test_release
# Answers `version` like Traefik and otherwise stays up like the service.
- name: Write the stand-in binaries
ansible.builtin.copy:
dest: "/opt/molecule-download/{{ traefik_test_release }}/traefik"
mode: "0755"
content: |
#!/bin/sh
case "$1" in
version) echo "Version: {{ traefik_test_release | regex_replace('^v', '') }}" ;;
*) exec sleep infinity ;;
esac
loop: ["{{ traefik_verify_other_version }}", "{{ traefik_version }}"]
loop_control:
loop_var: traefik_test_release
- name: Pack the stand-in archives
ansible.builtin.command:
argv: [tar, -czf, "{{ traefik_test_archive }}", -C, "/opt/molecule-download/{{ traefik_test_release }}", traefik]
creates: "{{ traefik_test_archive }}"
vars:
traefik_test_archive: "/opt/molecule-download/{{ traefik_test_release }}/traefik_{{ traefik_test_release }}_{{ traefik_os }}_{{ traefik_arch }}.tar.gz"
loop: ["{{ traefik_verify_other_version }}", "{{ traefik_version }}"]
loop_control:
loop_var: traefik_test_release
- name: Write the checksums files in the release format
ansible.builtin.shell:
cmd: sha256sum traefik_*.tar.gz > traefik_{{ traefik_test_release }}_checksums.txt
chdir: "/opt/molecule-download/{{ traefik_test_release }}"
creates: "traefik_{{ traefik_test_release }}_checksums.txt"
loop: ["{{ traefik_verify_other_version }}", "{{ traefik_version }}"]
loop_control:
loop_var: traefik_test_release
@@ -5,7 +5,6 @@
vars:
traefik_update: true
traefik_version: "{{ traefik_verify_target }}"
traefik_release_url: "file:///opt/molecule-download/{{ traefik_verify_target }}"
- name: Read the Traefik version after the update to {{ traefik_verify_target }}
ansible.builtin.command: /usr/local/bin/traefik version
+11 -38
View File
@@ -107,40 +107,13 @@
name: traefik
register: traefik_unit
# The dummy credentials make the ACME request fail, logged as "Unable to obtain ACME certificate
# for domain(s)". The log keeps the lines of the process converge restarted, so only a line
# stamped (RFC 3339, first field) since the running process started counts.
- name: Wait until the running Traefik has logged the ACME failure
ansible.builtin.shell:
executable: /bin/bash
cmd: |
set -euo pipefail
started=$(systemctl show --timestamp=unix -P ExecMainStartTimestamp traefik)
if [[ ! $started =~ ^@[0-9]+$ ]]; then
echo "no start time for traefik: '${started}'" >&2
exit 1
fi
last=$(grep 'Unable to obtain ACME certificate' /etc/traefik/logs/traefik.log | tail -n 1 | cut -d ' ' -f 1) || true
# Fails closed: a missing line, an unparseable stamp or an older one all end in exit 1.
if [ -n "$last" ] && stamp=$(date -d "$last" +%s) && [ "$stamp" -ge "${started#@}" ]; then
exit 0
fi
echo "no ACME failure logged since Traefik started at ${started} (last: ${last:-none})" >&2
exit 1
register: traefik_acme_failure
changed_when: false
until: traefik_acme_failure.rc == 0
retries: 30
delay: 2
- name: Let the ACME failures against the dummy credentials play out
ansible.builtin.pause:
seconds: 15
- name: Read the service state after the ACME failure
- name: Read the service state after the wait
ansible.builtin.service_facts:
- name: Read the restart count after the ACME failure
ansible.builtin.systemd:
name: traefik
register: traefik_unit_after_acme
- name: The pinned version is installed
ansible.builtin.assert:
that:
@@ -251,8 +224,6 @@
that:
- ansible_facts.services['traefik.service'].state == 'running'
- ansible_facts.services['traefik.service'].status == 'enabled'
# Restart=always would hide a crash on the ACME failure from the state above.
- traefik_unit_after_acme.status.NRestarts == '0'
- traefik_unit.status.NoNewPrivileges == 'yes'
- traefik_unit.status.MemoryDenyWriteExecute == 'yes'
- "'cap_net_bind_service' in traefik_unit.status.AmbientCapabilities | lower"
@@ -293,15 +264,17 @@
traefik_ufw_key_443: "{{ ('allow|443|||||in' | hash('sha1'))[:10] }}"
traefik_ufw_tagged: "{{ traefik_ufw_added.stdout_lines | select('match', '^ufw ') | select('search', 'ansible-ufw') | list }}"
# A version bump through the update path and mortis.kamino._binary_update: down to another
# release and back to the role default, both with traefik_update, from prepare.yml's stand-ins.
# After the idempotence step, because each run changes the binary, and before the remove path.
# It leaves the stand-in stub installed, so nothing after it may assert real Traefik behaviour.
- name: Verify the update path with stand-in releases
# A real version bump through the update path and mortis.kamino._binary_update: down to another
# release and back to the role default, both with traefik_update. After the idempotence step,
# because each run changes the binary, and before the remove path, which deletes it.
- name: Verify the update path with real Traefik releases
hosts: all
gather_facts: false
vars_files:
- ../../defaults/main.yml
vars:
# Any published release other than the role default, with a checksum file.
traefik_verify_other_version: v3.7.18
tasks:
- name: The other release differs from the role default
ansible.builtin.assert:
+2 -2
View File
@@ -12,7 +12,7 @@
# would otherwise be kept and then fail the checksum check.
- name: Download Traefik archive
ansible.builtin.get_url:
url: "{{ traefik_release_url }}/{{ traefik_archive_name }}"
url: "https://github.com/traefik/traefik/releases/download/{{ traefik_version }}/{{ traefik_archive_name }}"
dest: "{{ traefik_local_archive }}"
mode: "0644"
force: true
@@ -20,7 +20,7 @@
- name: Download Traefik checksums
ansible.builtin.get_url:
url: "{{ traefik_release_url }}/traefik_{{ traefik_version }}_checksums.txt"
url: "https://github.com/traefik/traefik/releases/download/{{ traefik_version }}/traefik_{{ traefik_version }}_checksums.txt"
dest: /tmp/traefik_checksums.txt
mode: "0644"
force: true