diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 48d5238..cf90eb9 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -7,6 +7,23 @@ // but opens no PRs or Dependency Dashboard until someone approves updates in // the Mend portal. Repo config overrides it; tested on function-insights-query. mode: 'full', + // Every non-major update merges itself once the required checks pass (build, + // lint, unit-test, e2e), like the configuration repos (majors: see + // packageRules): Renovate labels the PR for + // e2e, renovate-approve approves it (it reads "Automerge: Enabled" from the PR + // body when the PR opens) and Renovate merges it. + autoApprove: true, + automerge: true, + automergeType: 'pr', + labels: [ + 'automated', + 'run-e2e-tests', + ], + // The "Automerge: Enabled" note (configDescription) and the rebase checkbox + // (controls) come before the release and vulnerability notes. GitHub cuts PR + // bodies at 65k characters; a security PR with many advisories otherwise loses + // that note, and renovate-approve never approves it. + prBodyTemplate: '{{{header}}}{{{table}}}{{{warnings}}}{{{configDescription}}}{{{controls}}}{{{notes}}}{{{changelogs}}}{{{footer}}}', ignorePaths: [ // Renovate defaults '**/node_modules/**', @@ -30,16 +47,49 @@ }, packageRules: [ { - // Normal Go module updates wait 3 days after release, so a compromised - // version is more likely to be caught upstream before Renovate proposes - // it. Security fixes are not delayed (vulnerabilityAlerts sets no - // minimumReleaseAge). Scoped to Go modules: the Go proxy publishes - // release dates, and updates without one would be held back forever. - matchDatasources: [ - 'go', + // Every update waits 3 days after its release (Go modules, Go toolchain, + // function packages in example/, image tags), so a compromised version is + // more likely to be caught upstream before Renovate proposes it. Security + // fixes are not delayed: Renovate force-applies vulnerabilityAlerts, which + // has no minimumReleaseAge. + matchUpdateTypes: [ + 'major', + 'minor', + 'patch', + 'pin', + 'digest', + 'pinDigest', ], minimumReleaseAge: '3 days', }, + { + // No release date: digests, and Crossplane packages (xpkg.upbound.io + // publishes none). With the default (timestamp-required) they would wait + // forever; let them through when the date is unknown, wait 3 days when it + // is known. The Crossplane packages are only the function refs in + // example/ manifests, not part of the built function. + matchUpdateTypes: [ + 'digest', + 'pinDigest', + ], + minimumReleaseAgeBehaviour: 'timestamp-optional', + }, + { + matchManagers: [ + 'crossplane', + ], + minimumReleaseAgeBehaviour: 'timestamp-optional', + }, + { + // Major updates can change APIs that e2e only partly covers: they still + // run e2e (label) but wait for a human review. Security fixes merge + // themselves even when major (vulnerabilityAlerts is force-applied). + matchUpdateTypes: [ + 'major', + ], + autoApprove: false, + automerge: false, + }, { // Pin Dockerfile images by digest (base image, dockerfile syntax), so a // build always uses the exact image Renovate proposed; digest updates come @@ -54,12 +104,7 @@ pinDigests: true, }, { - // Base image updates merge themselves after e2e, like security fixes: a new - // distroless digest is how the base image gets its fixes (CA certificates, - // tzdata), and OSV can't flag those. Pin and digest updates only (same tag, - // new build); a tag change (e.g. debian12 -> debian13) still gets a review. - // One grouped PR: e2e runs one at a time per repo and GitHub keeps only one - // waiting run, so fewer parallel automatic PRs means fewer cancelled runs. + // Base image pin and digest updates (same tag, new build) in one PR. matchManagers: [ 'dockerfile', ], @@ -71,13 +116,25 @@ 'digest', ], groupName: 'base images', - labels: [ - 'automated', - 'run-e2e-tests', + }, + { + // Non-major Go module updates in one PR. Every merge puts the other open + // PRs behind main (branch protection requires up to date), and each rebase + // re-runs e2e, so fewer PRs merge faster. The Go toolchain (depType + // toolchain) keeps its own PR, so a Go upgrade can't hold back the modules. + matchManagers: [ + 'gomod', + ], + matchDepTypes: [ + 'require', + 'indirect', + ], + matchUpdateTypes: [ + 'minor', + 'patch', + 'digest', ], - autoApprove: true, - automerge: true, - automergeType: 'pr', + groupName: 'go dependencies', }, { matchManagers: [ @@ -89,28 +146,24 @@ groupName: 'examples', }, ], - // Security fixes merge themselves: for a dependency with a published advisory - // (OSV data), Renovate opens a PR right away, labels it for e2e, approves it and - // merges it once the branch protection's required checks pass (build, lint and - // unit-test, plus e2e in repos with an e2e/ harness; solutions-gitops-prod). - // Base image pin/digest updates merge themselves the same way (packageRules - // above). Every other update still waits for a human review. - // Go itself counts: the build toolchain is the `toolchain` line in go.mod (the - // shared CI and e2e workflows build with it), so a Go patch release with an - // advisory lands in this PR too. + // Security fixes: for a dependency with a published advisory (OSV data), + // Renovate opens a PR right away, without the 3-day wait. Go itself counts: + // the build toolchain is the `toolchain` line in go.mod (the shared CI and e2e + // workflows build with it), so a Go patch release with an advisory lands here. osvVulnerabilityAlerts: true, vulnerabilityAlerts: { - // One PR for all open advisories in a repo. e2e runs one at a time per repo - // (shared control plane name), and GitHub keeps only one waiting run, so - // several security PRs at once would cancel each other's e2e. Downside: one - // bump that breaks e2e holds back every other fix in that repo. If that - // happens, pin or exclude the bad dependency (packageRules) or split the PR. + // One PR for all open advisories in a repo: e2e runs one at a time per repo + // (shared control plane name), so fewer PRs land faster. Downside: one bump + // that breaks e2e holds back every other fix in that repo. If that happens, + // pin or exclude the bad dependency (packageRules) or split the PR. groupName: 'security fixes', labels: [ 'automated', 'security', 'run-e2e-tests', ], + // Explicit, although the top level already sets them: Renovate force-applies + // this block to security updates, so these can't be overridden by a rule. autoApprove: true, automerge: true, automergeType: 'pr', diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 966e399..89cf206 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -68,10 +68,13 @@ jobs: (github.event.action == 'synchronize' && github.event.pull_request.head.repo.full_name == github.repository)) # up test names the control plane -uptest-, so every run in this - # repo uses the same one: run them one at a time. + # repo uses the same one: run them one at a time. queue: max keeps up to 100 + # runs waiting in order; the default (single) keeps only one and cancels the + # rest, and a cancelled run posts no e2e status, so its PR would never merge. concurrency: group: e2e-control-plane cancel-in-progress: false + queue: max runs-on: ubuntu-24.04 steps: - name: Checkout