fix(renovate): fail-safe dry run, catch-all post-upgrade rule, merge open items
- renovate.yml: a workflow_dispatch is a dry run unless the input is exactly "false" (an empty input no longer goes live); drop RENOVATE_BINARY_SOURCE install, the -full image ships its tools. - renovate.json: the postUpgradeTasks rule matches every package, because with executionMode branch only the first upgrade of a branch counts; the script is a no-op when no image input changed. - bump_image_versions.py: docstring describes the real wiring. - CLAUDE.md, CONTRIBUTING.md: one open item for the first live run, runner slot note. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
1 parent
7730440759
commit
b92adb931c
5 files changed
+38
-28
No files matched your search
@@ -51,12 +51,13 @@ jobs:
|
|||||||
RENOVATE_REPOSITORIES: ${{ github.repository }}
|
RENOVATE_REPOSITORIES: ${{ github.repository }}
|
||||||
RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
RENOVATE_GIT_AUTHOR: "Renovate Bot <[email protected]>"
|
RENOVATE_GIT_AUTHOR: "Renovate Bot <[email protected]>"
|
||||||
RENOVATE_BINARY_SOURCE: install
|
|
||||||
# postUpgradeTasks may run exactly this one command (anchored, no wildcard); the JSON
|
# postUpgradeTasks may run exactly this one command (anchored, no wildcard); the JSON
|
||||||
# string holds a regex, hence the doubled backslash.
|
# string holds a regex, hence the doubled backslash.
|
||||||
RENOVATE_ALLOWED_COMMANDS: '["^python3 scripts/bump_image_versions\\.py origin/main$"]'
|
RENOVATE_ALLOWED_COMMANDS: '["^python3 scripts/bump_image_versions\\.py origin/main$"]'
|
||||||
LOG_LEVEL: ${{ github.event_name == 'workflow_dispatch' && 'debug' || 'info' }}
|
LOG_LEVEL: ${{ github.event_name == 'workflow_dispatch' && 'debug' || 'info' }}
|
||||||
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
|
# Fail safe: only the schedule is live. A manual dispatch is a dry run unless the input is
|
||||||
|
# exactly the string "false" (an empty input from an API or CLI dispatch stays a dry run).
|
||||||
|
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run != 'false' && 'true' || 'false' }}
|
||||||
run: |
|
run: |
|
||||||
if [ "$DRY_RUN" = "true" ]; then
|
if [ "$DRY_RUN" = "true" ]; then
|
||||||
export RENOVATE_DRY_RUN=full
|
export RENOVATE_DRY_RUN=full
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ protection, or create tags: those are the operator's.
|
|||||||
`image.yml` (`scripts/bump_image_versions.py [<base-ref>]`, idempotent, edits only the
|
`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
|
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.
|
`main`. PR 2 moves the consumers' `image:<version>@sha256:<digest>` pins to that digest.
|
||||||
`renovate.json` runs the script as a `postUpgradeTasks` command (branch mode, file filter
|
`renovate.json` runs the script as a `postUpgradeTasks` command of a catch-all rule (matches every package, since
|
||||||
`image.yml`; allowed by the one anchored regex in `RENOVATE_ALLOWED_COMMANDS` of `renovate.yml`),
|
only the first upgrade of a branch counts; 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
|
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).
|
`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
|
- **Bot-diff gate:** the `lint` workflow runs `scripts/check_bot_pr_diff.py` on pull requests. A
|
||||||
@@ -104,20 +104,28 @@ protection, or create tags: those are the operator's.
|
|||||||
- **Dry run:** Actions > Renovate > Run workflow with `dry_run=true` (the default for a manual run;
|
- **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
|
sets `RENOVATE_DRY_RUN=full`, `LOG_LEVEL=debug`). Read the debug log: no branch or PR is created. The
|
||||||
schedule runs live.
|
schedule runs live.
|
||||||
- **Unverified (settle with the first dry run and first live run):** that the job token can run Renovate on
|
- **Open item: the first live run (do not enable automerge for bot PRs until one has shown it gets Lint and
|
||||||
Gitea (user lookup, branch push, PR creation); that `origin/main` exists and the clone is deep enough
|
Build).** The dry run proves the READS (lookups, config, branch plan) and, from the Renovate 44.161.0
|
||||||
for the merge-base in Renovate's checkout (the script fails with its one-line error otherwise); that
|
source (confirm by the log line for the post-upgrade task), also runs `postUpgradeTasks`. Only the first
|
||||||
`python3` is in the image; that the `permissions:` block is enforced on this Gitea. Also unverified:
|
LIVE run proves the writes: (1) that the job token can push a branch and open a PR. Renovate puts the
|
||||||
that PRs opened with the job token trigger the PR workflows. Gitea, like GitHub, may not start
|
token in the clone URL, while `lint.yml` uses an http extraheader, so basic auth with the job token is
|
||||||
workflows for events created by the job token, in which case the required `Lint` and `Build` checks
|
unproven; a fallback is to set `GIT_CONFIG_COUNT`/`GIT_CONFIG_KEY_0`/`GIT_CONFIG_VALUE_0` for the same
|
||||||
never run and automerge cannot work.
|
extraheader. (2) That PRs opened with the job token trigger the PR workflows: Gitea, like GitHub, may not
|
||||||
- **Open decision (do not pick without the operator):** if job-token PRs do not trigger CI, either
|
start workflows for events created by the job token, in which case the required `Lint` and `Build`
|
||||||
(a) push the PR with a user token held as a repo secret from a Kamino-only user, or (b) have
|
checks never run and automerge cannot work. If so, the decision is the operator's: either push the PR
|
||||||
`renovate.yml` dispatch lint against the branch. Until decided, bot PRs need a manual run.
|
with a user token held as a repo secret from a Kamino-only user, or have `renovate.yml` dispatch lint
|
||||||
|
against the branch; until then bot PRs need a manual run. (3) That bot PRs are held by `main`'s required
|
||||||
|
status checks (check the branch protection). Also confirm in the log: Renovate clones blobless with full
|
||||||
|
history, so `origin/main` exists for the script (source-based); `python3` is in the image; the
|
||||||
|
`permissions:` block is enforced on this Gitea; `github.head_ref` is populated (the gate fails closed
|
||||||
|
on an empty one, via `EVENT_NAME`). Safety net: a failing or disallowed post-upgrade command opens the
|
||||||
|
PR WITHOUT the bump plus a red `renovate/artifacts` status, and `check_image_versions.py bump` then
|
||||||
|
fails lint.
|
||||||
|
- **The workflow holds the runner's slot:** the `kamino-runner` host has a single slot (the label is
|
||||||
|
`kamino-docker`), and the Renovate job may run up to 30 minutes (`timeout-minutes`) from 03:17 UTC, so
|
||||||
|
Lint, Build and Molecule checks queue behind it.
|
||||||
- **Not enabled yet:** credentials for the `git.rkdr.net` registry (`hostRules`) and pin-follow. The
|
- **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
|
`pre-commit` manager is beta.
|
||||||
(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
|
- **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 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
|
- **The guard runs from `main`:** the lint step extracts `scripts/` from `origin/main` and runs the
|
||||||
|
|||||||
+4
-3
@@ -36,9 +36,10 @@
|
|||||||
- `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, with the workflow's job token; no cluster code involved). To dry-run after changing the
|
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
|
config: Actions > Renovate > Run workflow with `dry_run=true`, then read the debug log. The dry run
|
||||||
pull requests opened with the job token start the PR workflows is unverified; if not, they need a
|
proves reads (and runs the post-upgrade task); whether the job token can push and open a pull
|
||||||
manual lint run (open decision, see CLAUDE.md). Pull requests from `renovate/` branches must pass
|
request, and whether such pull requests start the PR workflows, only the first live run shows
|
||||||
|
(open item, see CLAUDE.md); until then they may need a manual lint run. 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/` (the production image set); the
|
||||||
`Check image pins` step fails if they do.
|
`Check image pins` step fails if they do.
|
||||||
|
|||||||
+3
-5
@@ -77,11 +77,9 @@
|
|||||||
"automerge": true
|
"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.",
|
"description": "Every update runs scripts/bump_image_versions.py against origin/main as a postUpgradeTasks command (the base ref and clone depth in Renovate's checkout are verified by the first dry run). The rule matches every package (matchPackageNames *, which strict validation requires as a selector) on purpose: with executionMode branch only the FIRST upgrade's postUpgradeTasks of a branch counts and a branch can carry several upgrades; the script is a no-op when no image input (requirements-dev.txt, .pre-commit-config.yaml, images/**) changed and otherwise makes the PATCH bump of the image version in image.yml. The command must match RENOVATE_ALLOWED_COMMANDS in renovate.yml exactly.",
|
||||||
"matchFileNames": [
|
"matchPackageNames": [
|
||||||
"requirements-dev.txt",
|
"*"
|
||||||
".pre-commit-config.yaml",
|
|
||||||
"images/**"
|
|
||||||
],
|
],
|
||||||
"postUpgradeTasks": {
|
"postUpgradeTasks": {
|
||||||
"commands": [
|
"commands": [
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ order; an entry that cannot be parsed unambiguously is an error); comments, quot
|
|||||||
the rest of the file are kept. Untracked files count as inputs unless git ignores them, so a cache
|
the rest of the file are kept. Untracked files count as inputs unless git ignores them, so a cache
|
||||||
under images/ must be in .gitignore.
|
under images/ must be in .gitignore.
|
||||||
|
|
||||||
It is meant to run later as a Renovate `postUpgradeTasks` command (Phase 2/3 of the
|
It runs as a Renovate `postUpgradeTasks` command: renovate.json sets it on a catch-all
|
||||||
Renovate plan; renovate.json does not enable it yet), so a dependency bump that changes an
|
packageRule (matches every package, executionMode branch, fileFilters limited to .gitea/workflows/image.yml),
|
||||||
image input carries its version bump and passes the `bump` check without a human edit.
|
allowed by RENOVATE_ALLOWED_COMMANDS of .gitea/workflows/renovate.yml. It is a no-op when no image
|
||||||
|
input changed, so a dependency bump that changes an image input carries its version bump and
|
||||||
|
passes the `bump` check without a human edit.
|
||||||
Moving the consumers' pins to the digest the build produces stays a separate, later pull
|
Moving the consumers' pins to the digest the build produces stays a separate, later pull
|
||||||
request (build on main, then the pin follow-up).
|
request (build on main, then the pin follow-up).
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user