Renovate runs on every push to main, so after each merge the next bot pull request is rebased without waiting for the daily schedule; the renovate concurrency group still queues at most one run. The job timeout drops from 30 to 10 minutes. The rule that disabled updates to renovate.yml is replaced by a weekly rule for renovate/renovate: a 3-day release age, never automerged, since the job runs with the write-capable bot token. One pull request moves the pin in renovate.yml and its copy in lint.yml. RENOVATE_DOCKER_MAX_PAGES stays within Docker Hub's anonymous paging limit, so the image's release timestamps are found and the wait applies. Our own Docker images get an explicit zero release age. Every rule description is cut to at most two sentences, and the top-level one now says that an update with no release timestamp gets no wait. Closes: #172 Closes: #188 Assisted-by: Claude Code
136 lines
7.2 KiB
YAML
136 lines
7.2 KiB
YAML
name: Renovate
|
|
|
|
# Dependency updates for this repository (renovate.json). Runs only on the Collection's own runner
|
|
# (label kamino-docker), and no credential from anywhere else is used here.
|
|
# 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 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 refuses that user.
|
|
# No GitHub token exists, so the pre-commit hooks are looked up with git ls-remote instead
|
|
# (renovate.json, git-tags), which needs RENOVATE_GITHUB_TOKEN_WARN=false below.
|
|
#
|
|
# Dry run: Actions > Renovate > Run workflow, dry_run=true (the default for a manual run), then
|
|
# read the debug log. Every other trigger runs live: a push to main rebases the next bot pull
|
|
# request, and an Images run's completion opens the pin pull request for a new image version.
|
|
# Gitea starts a workflow_run only for a run a person triggered, and its event carries no input
|
|
# or credential.
|
|
on: # yamllint disable-line rule:truthy
|
|
# Only one bot pull request merges per run when main must be up to date; a run after each merge
|
|
# rebases the next one.
|
|
push:
|
|
branches:
|
|
- main
|
|
# Images runs only on main (push, dispatch), and this job reads nothing from its run but the conclusion.
|
|
workflow_run: # zizmor: ignore[dangerous-triggers]
|
|
workflows: [Images]
|
|
types: [completed]
|
|
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"
|
|
|
|
# The job token is not used for Renovate (see above): read-only is enough for the job itself.
|
|
permissions:
|
|
contents: read
|
|
|
|
# Never two runs at once; a running one is not cancelled (it may be mid-push), and a burst of
|
|
# pushes leaves at most one run waiting.
|
|
concurrency:
|
|
group: renovate
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
renovate:
|
|
# Only in this repository (a copy elsewhere has no such secret), and not after a failed Images run.
|
|
if: >-
|
|
(github.repository == 'mortis/kamino' || github.repository == 'Mortis/Kamino') &&
|
|
(github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')
|
|
runs-on: kamino-docker
|
|
# A run takes seconds to about two minutes.
|
|
timeout-minutes: 10
|
|
# Docker Hub image, pinned by digest. The -full flavour ships python3 for the report check
|
|
# below and pip-compile for lock refreshes. Renovate proposes its own bump weekly, never
|
|
# automerged (renovate.json), and moves lint.yml's copy of this pin in the same pull request.
|
|
# The image sets RENOVATE_BINARY_SOURCE=global, so pip-compile runs on the image's own python
|
|
# and ignores the Python that Renovate reads from the lock header: that python's minor version
|
|
# must equal .python-version, or a lock refresh rewrites the header (check_image_versions.py
|
|
# pins then fails the pull request). Check the image's python before merging a bump;
|
|
# RENOVATE_BINARY_SOURCE=install would make Renovate install the header's python, but it also
|
|
# downloads tools at run time (pip-tools included).
|
|
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.RENOVATE_BOT_TOKEN }}
|
|
# Git auth: see the run block. The host the header is scoped to.
|
|
GIT_HOST_URL: ${{ github.server_url }}/
|
|
RENOVATE_GIT_AUTHOR: "Renovate Bot <[email protected]>"
|
|
# No GitHub token exists, and the hooks go through git-tags (see the header). Without this
|
|
# Renovate marks every github-tags dependency as skipped before the package rule applies.
|
|
RENOVATE_GITHUB_TOKEN_WARN: "false"
|
|
# Docker Hub refuses anonymous paging past page 10; at more pages renovate/renovate gets
|
|
# no release timestamps, so its minimumReleaseAge would not apply.
|
|
RENOVATE_DOCKER_MAX_PAGES: "10"
|
|
# Renovate exits 0 when a repository run fails (e.g. the clone): with this it exits with
|
|
# an error-specific code instead (7 for an external host error such as a failed clone).
|
|
RENOVATE_EXIT_CODE_FOR_ERRORS: "true"
|
|
# The JSON report is checked after the run (see below).
|
|
RENOVATE_REPORT_TYPE: file
|
|
LOG_LEVEL: ${{ github.event_name == 'workflow_dispatch' && 'debug' || 'info' }}
|
|
# Fail safe: 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 one); every other trigger is live.
|
|
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run != 'false' && 'true' || 'false' }}
|
|
run: |
|
|
if [ -z "$RENOVATE_TOKEN" ]; then
|
|
echo "::error::The repository secret RENOVATE_BOT_TOKEN is not set (token of the Kamino-only bot user)"
|
|
exit 1
|
|
fi
|
|
# Git over HTTPS with the bot token. Renovate's own rewrite puts the token in the URL
|
|
# (https://<token>@host/...), which git drops when the server redirects, and Gitea
|
|
# redirects the clone. The header is sent on every request to the host,
|
|
# as lint.yml does with its token. Renovate does not pass GIT_CONFIG_* from its environment to git
|
|
# (only an allowlist, util/exec/env.js), but it does pass HOME, so a global git config
|
|
# is the path that reaches its git children. The token is read from the environment.
|
|
git config --global "http.${GIT_HOST_URL}.extraheader" "AUTHORIZATION: bearer ${RENOVATE_TOKEN}"
|
|
report="${RUNNER_TEMP:-/tmp}/renovate-report.json"
|
|
rm -f "$report"
|
|
export RENOVATE_REPORT_PATH="$report"
|
|
if [ "$DRY_RUN" = "true" ]; then
|
|
export RENOVATE_DRY_RUN=full
|
|
fi
|
|
rc=0
|
|
renovate || rc=$?
|
|
if [ "$rc" -ne 0 ]; then
|
|
echo "::error::Renovate exited with code $rc"
|
|
exit "$rc"
|
|
fi
|
|
# Fail on a missing or unreadable report and on any ERROR (50) or FATAL (60) problem,
|
|
# global or per repository. Warnings (40) do not fail the job.
|
|
python3 -I -c '
|
|
import json, sys
|
|
try:
|
|
with open(sys.argv[1], encoding="utf-8") as handle:
|
|
report = json.load(handle)
|
|
except (OSError, ValueError) as err:
|
|
sys.exit("::error::no readable Renovate report: " + str(err))
|
|
problems = list(report.get("problems", []))
|
|
for repo in report.get("repositories", {}).values():
|
|
problems.extend(repo.get("problems", []))
|
|
bad = [p for p in problems if p.get("level", 0) >= 50]
|
|
for p in bad:
|
|
print("::error::Renovate problem: " + str(p.get("msg", "")))
|
|
sys.exit(1 if bad else 0)
|
|
' "$report"
|