ci(gitea): warn before the Gitea release key stops verifying releases #288

Merged
Defame1297 merged 3 commits from ci/gitea-release-key into main 2026-11-22 08:30:41 +00:00
Owner

The gitea role accepts a release only when it has a valid signature by gitea_gpg_key_id or one of its subkeys. If the Gitea release key expires, is revoked or is replaced, every install and update fails closed, with no warning beforehand. This adds an early warning.

What it adds

  • scripts/check_gitea_release_key.py:
    • reads the pins from roles/gitea/defaults/main.yml;
    • fetches the release key into a throwaway keyring, plus only the .asc of the pinned release (never the binary);
    • fails when the primary key or a signing subkey expires within 60 days, is revoked or expired, or when a signature in the .asc is not by a valid signing key of the pinned key;
    • says in its docstring what to do on a failure.
  • .gitea/workflows/gitea-release-key.yml:
    • When it runs: weekly, by hand, and on pull requests that change the role defaults or the check, so a gitea_version bump is checked against the new release's signature.
    • The ci image at the pin of lint.yml, on kamino-docker, with read-only permissions and no secrets.
    • The image has gpgv but not gpg, so the job installs gpg and gpg-agent per run. The check therefore doesn't become an input of the image.
    • The job fails if gpg, gpg-agent or gpgconf is missing, so the key tests can never be skipped quietly there.
  • tests/scripts/test_check_gitea_release_key.py: offline tests with throwaway keys. The key tests skip without gpg, so the Lint job's unittest run still covers the parsing and rendering tests.
  • Supporting changes:
    • The workflow joins the pin consumers in check_image_versions.py and check_bot_pr_diff.py, with tests. Without that, the bot-diff gate would refuse Renovate's next ci pin follow-up, which edits every workflow.
    • The workflow and script go on the molecule selector's IGNORED list (no scenario reads them), with a test.
    • The consumer lists in CLAUDE.md, CONTRIBUTING.md, docs/images/ci.md and the renovate.json description are updated.
    • A Notes pointer in roles/gitea/README.md, and a trivial changelog fragment.

Verified

  • tests/scripts: 223 tests OK. Without gpg on PATH, 9 are skipped.
  • Hooks: ruff, yamllint, actionlint, zizmor, check_image_versions.py pins and all commit hooks pass, as does ansible-test sanity on push.
  • Live run against the role defaults (Gitea 28.4.0): exit 0. The key expires on 2027-06-26, and a valid subkey signed the release.
  • Independent subagent review: READY, no blocker and no should-fix. Its two nits are applied: the ci.md consumer list, and the job failing when a gpg tool is missing.

Not verified

  • The workflow itself has not run in CI yet. This PR's own run, triggered by its path filter, is the first; in particular, it tests the per-run apt install in the ci image.
  • I did not run renovate --platform=local for the renovate.json change. It only edits a description string.

🤖 Generated with Claude Code

The `gitea` role accepts a release only when it has a valid signature by `gitea_gpg_key_id` or one of its subkeys. If the Gitea release key expires, is revoked or is replaced, every install and update fails closed, with no warning beforehand. This adds an early warning. ## What it adds - **`scripts/check_gitea_release_key.py`:** - reads the pins from `roles/gitea/defaults/main.yml`; - fetches the release key into a throwaway keyring, plus only the `.asc` of the pinned release (never the binary); - fails when the primary key or a signing subkey expires within 60 days, is revoked or expired, or when a signature in the `.asc` is not by a valid signing key of the pinned key; - says in its docstring what to do on a failure. - **`.gitea/workflows/gitea-release-key.yml`:** - When it runs: weekly, by hand, and on pull requests that change the role defaults or the check, so a `gitea_version` bump is checked against the new release's signature. - The `ci` image at the pin of `lint.yml`, on `kamino-docker`, with read-only permissions and no secrets. - The image has `gpgv` but not `gpg`, so the job installs `gpg` and `gpg-agent` per run. The check therefore doesn't become an input of the image. - The job fails if `gpg`, `gpg-agent` or `gpgconf` is missing, so the key tests can never be skipped quietly there. - **`tests/scripts/test_check_gitea_release_key.py`:** offline tests with throwaway keys. The key tests skip without `gpg`, so the Lint job's unittest run still covers the parsing and rendering tests. - **Supporting changes:** - The workflow joins the pin consumers in `check_image_versions.py` and `check_bot_pr_diff.py`, with tests. Without that, the bot-diff gate would refuse Renovate's next `ci` pin follow-up, which edits every workflow. - The workflow and script go on the molecule selector's IGNORED list (no scenario reads them), with a test. - The consumer lists in `CLAUDE.md`, `CONTRIBUTING.md`, `docs/images/ci.md` and the `renovate.json` description are updated. - A Notes pointer in `roles/gitea/README.md`, and a `trivial` changelog fragment. ## Verified - `tests/scripts`: 223 tests OK. Without `gpg` on PATH, 9 are skipped. - **Hooks:** ruff, yamllint, actionlint, zizmor, `check_image_versions.py pins` and all commit hooks pass, as does `ansible-test sanity` on push. - **Live run against the role defaults (Gitea 28.4.0): exit 0.** The key expires on 2027-06-26, and a valid subkey signed the release. - **Independent subagent review:** READY, no blocker and no should-fix. Its two nits are applied: the `ci.md` consumer list, and the job failing when a gpg tool is missing. ## Not verified - **The workflow itself has not run in CI yet.** This PR's own run, triggered by its path filter, is the first; in particular, it tests the per-run `apt` install in the `ci` image. - I did not run `renovate --platform=local` for the `renovate.json` change. It only edits a description string. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 1 commit 2026-11-22 07:34:52 +00:00
ci(gitea): warn before the Gitea release key stops verifying releases
Build / build (pull_request) Successful in 15s
Gitea release key / check (pull_request) Successful in 9s
Lint / lint (pull_request) Successful in 51s
Molecule / molecule (pull_request) Canceled after 36s
0837cc387f
The gitea role accepts a release only when it carries a valid signature by
gitea_gpg_key_id or one of its subkeys, so an expired, revoked or replaced
Gitea release key makes every install and update fail closed, without
warning, on the day it happens.

scripts/check_gitea_release_key.py reads the pins from the role defaults,
fetches the release key into a throwaway keyring and only the .asc of the
pinned release (never the binary), and fails when the primary key or a
signing subkey expires within 60 days, is revoked or expired, or when a
signature in the .asc is not by a valid signing key of the pinned key. Its
docstring says what to do on a failure.

The Gitea release key workflow runs it weekly, by hand, and on pull requests
that change the role defaults or the check, so a gitea_version bump is
checked against the new release's signature. It runs in the ci image at the
pin of lint.yml; that image has gpgv but not gpg, so the job installs gpg and
gpg-agent from the Ubuntu archive per run instead of making the check an
image input. The tests that make keys skip without gpg, so the Lint job's
unittest run (no gpg) still covers the parsing and rendering tests.

The workflow pins the ci image, so it joins the pin consumers of
check_image_versions.py and check_bot_pr_diff.py: Renovate's pin follow-up
edits every workflow, and the bot-diff gate would otherwise refuse that pull
request. The new workflow and script are on the molecule selector's IGNORED
list, since no scenario reads them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
CODEOWNERS rules requested review from Defame1297 2026-11-22 07:34:52 +00:00
Defame1297 added 1 commit 2026-11-22 07:37:51 +00:00
Merge branch 'main' into ci/gitea-release-key
Build / build (pull_request) Successful in 16s
Gitea release key / check (pull_request) Successful in 8s
Lint / lint (pull_request) Successful in 52s
Molecule / molecule (pull_request) Canceled after 7m59s
a7b9f47496
Defame1297 approved these changes 2026-11-22 07:37:58 +00:00
Dismissed
Defame1297 scheduled this pull request to auto merge when all checks succeed 2026-11-22 07:38:14 +00:00
Defame1297 approved these changes 2026-11-22 07:47:53 +00:00
Dismissed
Defame1297 added 1 commit 2026-11-22 08:08:10 +00:00
Merge branch 'main' into ci/gitea-release-key
Build / build (pull_request) Successful in 17s
Gitea release key / check (pull_request) Successful in 23s
Lint / lint (pull_request) Successful in 50s
Molecule / molecule (pull_request) Successful in 19m44s
957dd4f95f
Defame1297 dismissed Defame1297's review 2026-11-22 08:08:11 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

CODEOWNERS rules requested review from Defame1297 2026-11-22 08:08:11 +00:00
Defame1297 approved these changes 2026-11-22 08:12:12 +00:00
Defame1297 merged commit 7fd6de5df5 into main 2026-11-22 08:30:41 +00:00
Defame1297 deleted branch ci/gitea-release-key 2026-11-22 08:30:42 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#288