ci(renovate): run Renovate from a cron workflow on the Collection runner #20

Merged
Defame1297 merged 2 commits from feat/renovate-cron-workflow into main 2026-10-26 08:32:50 +00:00
4 changed files with 128 additions and 20 deletions
Showing only changes of commit 7730440759 - Show all commits

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
name: Renovate
# Dependency updates for this repository (renovate.json). Runs on the Collection's own runner
# (label kamino-docker, the untrusted side), never in the production cluster: code from this
# repository must not run there. The only credential is the job token (secrets.GITHUB_TOKEN);
# no org secret is referenced (only image.yml may). Unauthenticated GitHub lookups for the
# github.com pre-commit hooks may hit rate limits: best effort, no RENOVATE_GITHUB_COM_TOKEN exists.
#
# Dry run: Actions > Renovate > Run workflow, dry_run=true (the default for a manual run), then
# read the debug log. The schedule runs live.
on: # yamllint disable-line rule:truthy
schedule:
# Daily, off the hour so it avoids typical molecule and image runs.
- cron: "17 3 * * *"
workflow_dispatch:
inputs:
dry_run:
description: "Log what Renovate would do without branches or pull requests"
type: choice
options:
- "true"
- "false"
default: "true"
permissions:
contents: write
pull-requests: write
issues: write
# Never two runs at once; a running one is not cancelled (it may be mid-push).
concurrency:
group: renovate
cancel-in-progress: false
jobs:
renovate:
# Only in this repository (a copy elsewhere would run with its own job token).
if: github.repository == 'mortis/kamino' || github.repository == 'Mortis/Kamino'
runs-on: kamino-docker
timeout-minutes: 30
# Docker Hub image, pinned by digest like the cluster's CronJob (same version). The -full
# flavour ships python3 for the postUpgradeTasks command. Hand-bumped: renovate.json
# disables updates for this file.
container:
image: renovate/renovate:44.161.0-full@sha256:ddbf02e44b542343c9df696b88fd953f04cc3ee5f771221805ff8efb26595416
steps:
- name: Run Renovate
env:
RENOVATE_PLATFORM: gitea
RENOVATE_ENDPOINT: ${{ github.server_url }}/api/v1/
RENOVATE_REPOSITORIES: ${{ github.repository }}
RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RENOVATE_GIT_AUTHOR: "Renovate Bot <[email protected]>"
RENOVATE_BINARY_SOURCE: install
# postUpgradeTasks may run exactly this one command (anchored, no wildcard); the JSON
# string holds a regex, hence the doubled backslash.
RENOVATE_ALLOWED_COMMANDS: '["^python3 scripts/bump_image_versions\\.py origin/main$"]'
LOG_LEVEL: ${{ github.event_name == 'workflow_dispatch' && 'debug' || 'info' }}
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
run: |
if [ "$DRY_RUN" = "true" ]; then
export RENOVATE_DRY_RUN=full
fi
renovate
+31 -14
View File
@@ -59,10 +59,9 @@ protection, or create tags: those are the operator's.
(HTTP 401, run 2237), so the push uses the org Actions secrets `PACKAGE_PUSH_USER` and
`PACKAGE_PUSH_TOKEN`. Never print or use them anywhere else.
## Dependency automation (Renovate, Phase 0: configured, not active)
## Dependency automation (Renovate)
`renovate.json` is inert until the operator adds Kamino to the self-hosted instance's repository
list. Nothing below runs yet unless it says so.
`renovate.json` is run by `.gitea/workflows/renovate.yml` (see below). Items marked unverified have not run yet.
- **Policy:** minor and patch bumps automerge, majors are manual. `ansible-core` minor and major
are manual too (a new minor needs a `tests/sanity/ignore-2.NN.txt`), and `ansible-core` and
@@ -76,10 +75,10 @@ list. Nothing below runs yet unless it says so.
`image.yml` (`scripts/bump_image_versions.py [<base-ref>]`, idempotent, edits only the
version line; `check_image_versions.py bump` then passes). The merge builds the image on
`main`. PR 2 moves the consumers' `image:<version>@sha256:<digest>` pins to that digest.
Until Phase 2/3 enables the script as a `postUpgradeTasks` command (the cluster allows no
commands yet, and `renovate.json` must not list any), the bump in PR 1 is a hand edit, and
PR 2 stays a hand edit until Phase 4 (pin-follow for `git.rkdr.net/mortis/*` is
`enabled: false`; it needs a dry run against the registry first).
`renovate.json` runs the script as a `postUpgradeTasks` command (branch mode, file filter
`image.yml`; allowed by the one anchored regex in `RENOVATE_ALLOWED_COMMANDS` of `renovate.yml`),
so PR 1 carries the bump. PR 2 stays a hand edit until Phase 4 (pin-follow for
`git.rkdr.net/mortis/*` is `enabled: false`; it needs a dry run against the registry first).
- **Bot-diff gate:** the `lint` workflow runs `scripts/check_bot_pr_diff.py` on pull requests. A
head ref starting `renovate/` may only change version lines in `requirements-dev.txt`, `rev:`
lines in `.pre-commit-config.yaml`, FROM tags/digests and the `uv==` pin in `images/*/Dockerfile`,
@@ -94,13 +93,31 @@ list. Nothing below runs yet unless it says so.
a changelog fragment and a new `galaxy.yml` version, and only the operator tags.
- **No production images:** `check_image_versions.py pins` fails when anything under
`.gitea/workflows` mentions `git.rkdr.net/defame1297/`.
- **Not enabled yet:** the Renovate run itself, `postUpgradeTasks`, credentials for the
`git.rkdr.net` registry (`hostRules`), pin-follow, and a validated `renovate.json` on the
instance's Renovate version. The `pre-commit` manager is beta; the hooks come from github.com, so it
needs `GITHUB_COM_TOKEN` on the Renovate instance. Unverified: that bot PRs are held by `main`'s
required status checks (check the branch protection before enabling automerge), and that
`github.head_ref` is populated on this Gitea (the gate fails closed on an empty one, via
`EVENT_NAME`).
- **Where Renovate runs:** `.gitea/workflows/renovate.yml`, a daily cron (03:17 UTC) plus
`workflow_dispatch`, on the `kamino-runner` (`kamino-docker`): the untrusted side, so code from this
repository never runs in the production cluster (ADR 0004). It authenticates with the workflow's own
job token (`secrets.GITHUB_TOKEN`): no new account, no secret, and no org secret (only `image.yml` may
reference those). The job container is `renovate/renovate:<version>-full@sha256:...` from Docker Hub
(the `-full` flavour for `python3`), same version as the cluster's CronJob, hand-bumped (renovate.json
disables updates for the workflow file). Lookups of the github.com pre-commit hooks are
unauthenticated (no `RENOVATE_GITHUB_COM_TOKEN` exists) and may hit rate limits: best effort.
- **Dry run:** Actions > Renovate > Run workflow with `dry_run=true` (the default for a manual run;
sets `RENOVATE_DRY_RUN=full`, `LOG_LEVEL=debug`). Read the debug log: no branch or PR is created. The
schedule runs live.
- **Unverified (settle with the first dry run and first live run):** that the job token can run Renovate on
Gitea (user lookup, branch push, PR creation); that `origin/main` exists and the clone is deep enough
for the merge-base in Renovate's checkout (the script fails with its one-line error otherwise); that
`python3` is in the image; that the `permissions:` block is enforced on this Gitea. Also unverified:
that PRs opened with the job token trigger the PR workflows. Gitea, like GitHub, may not start
workflows for events created by the job token, in which case the required `Lint` and `Build` checks
never run and automerge cannot work.
- **Open decision (do not pick without the operator):** if job-token PRs do not trigger CI, either
(a) push the PR with a user token held as a repo secret from a Kamino-only user, or (b) have
`renovate.yml` dispatch lint against the branch. Until decided, bot PRs need a manual run.
- **Not enabled yet:** credentials for the `git.rkdr.net` registry (`hostRules`) and pin-follow. The
`pre-commit` manager is beta. Unverified: that bot PRs are held by `main`'s required status checks
(check the branch protection before enabling automerge), and that `github.head_ref` is populated on
this Gitea (the gate fails closed on an empty one, via `EVENT_NAME`).
- **Hand edits on a bot branch:** a commit pushed by hand to a `renovate/` branch makes Renovate treat
the branch as modified: it stops rebasing it, so merge that pull request by hand.
- **The guard runs from `main`:** the lint step extracts `scripts/` from `origin/main` and runs the
+6 -3
View File
@@ -33,9 +33,12 @@
- These files are in `galaxy.yml` `build_ignore`: such bumps do not change the Collection or its
version. A change consumers can see needs a changelog fragment, and only the maintainer
bumps the version and tags.
- `renovate.json` configures dependency bumps (minor and patch automerge, majors by hand). It is
not active yet: Renovate does not run against this repository, and until it does the bumps above
are made by hand. Pull requests from `renovate/` branches must pass
- `renovate.json` configures dependency bumps (minor and patch automerge, majors by hand). Renovate
runs for this repository in `.gitea/workflows/renovate.yml` (daily cron on the Collection's own
runner, with the workflow's job token; no cluster code involved). To dry-run after changing the
config: Actions > Renovate > Run workflow with `dry_run=true`, then read the debug log. Whether
pull requests opened with the job token start the PR workflows is unverified; if not, they need a
manual lint run (open decision, see CLAUDE.md). Pull requests from `renovate/` branches must pass
`scripts/check_bot_pr_diff.py`, which only allows version, tag, digest and pin lines.
- Workflows must not mention `git.rkdr.net/defame1297/` (the production image set); the
`Check image pins` step fails if they do.
+27 -3
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "INERT until Kamino is added to the self-hosted Renovate instance's repository list (the operator's step, Phase 3 of the Renovate plan). 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. postUpgradeTasks are NOT configured: the cluster allows no commands yet (Phase 2/3).",
"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 image-input rule runs scripts/bump_image_versions.py as a postUpgradeTasks command (allowed by RENOVATE_ALLOWED_COMMANDS of .gitea/workflows/renovate.yml, where Renovate runs).",
"extends": [
"config:recommended",
":enablePreCommit"
@@ -45,7 +45,7 @@
"customManagers": [
{
"customType": "regex",
"description": "The uv pin that installs the build-stage Python interpreters of the ci image (images/ci/Dockerfile). It is an image input: the version bump comes from scripts/bump_image_versions.py via postUpgradeTasks (to be enabled in Phase 2/3).",
"description": "The uv pin that installs the build-stage Python interpreters of the ci image (images/ci/Dockerfile). It is an image input: the version bump comes from scripts/bump_image_versions.py via postUpgradeTasks (rule below).",
"managerFilePatterns": [
"/^images/ci/Dockerfile$/"
],
@@ -70,12 +70,36 @@
],
"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 image version bump in image.yml (scripts/bump_image_versions.py via postUpgradeTasks) is not enabled yet; until then the pull request fails the version check and a human adds it.",
"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 image version bump in image.yml comes from scripts/bump_image_versions.py via postUpgradeTasks (rule below).",
"matchManagers": [
"dockerfile"
],
"automerge": true
},
{
"description": "Image inputs (the ci and molecule-ubuntu2404 images): the PR also carries the PATCH bump of the image version in image.yml, made by scripts/bump_image_versions.py against origin/main (the base ref and clone depth in Renovate's checkout are verified by the first dry run). The command must match RENOVATE_ALLOWED_COMMANDS in renovate.yml exactly.",
"matchFileNames": [
"requirements-dev.txt",
".pre-commit-config.yaml",
"images/**"
],
"postUpgradeTasks": {
"commands": [
"python3 scripts/bump_image_versions.py origin/main"
],
"fileFilters": [
".gitea/workflows/image.yml"
],
"executionMode": "branch"
}
},
{
"description": "The Renovate job container of renovate.yml runs with the job token: hand-bumped, never by the bot (the bot-diff gate would refuse a change to that file anyway).",
"matchFileNames": [
".gitea/workflows/renovate.yml"
],
"enabled": false
},
{
"description": "Majors are reviewed by hand.",
"matchUpdateTypes": [