Repository navigation
ci: one definition of the gate, so a tag runs what a PR runs - #500
Conversation
ci.yml gains a workflow_call trigger and release.yml calls it. Before this, the two files defined disjoint job sets and neither contained the string workflow_call, so v0.14.0 was published without test, lint, coverage, fuzz-smoke, packaging, modulefiles, install-script or labels ever running. ci.yml is made the reusable workflow rather than extracting a gate.yml, because a workflow_call job reports as '<caller> / <job>' and nineteen of main's twenty required contexts are pinned to the bare names. No branch protection change is needed. docker-build-push had no needs: at all and pushed to ghcr in parallel with the build. The gate is now a dependency of the graph's roots so everything downstream is transitively gated.
Recording both the job id and the declared name meant renaming a job's name: still matched on the id, so the mutation that renames modulefiles passed. A job reports under name: when it has one; only one of the two is ever the check name.
golangci-lint's modernize analyzer is blocking on changed code, and it was right
three times. No behaviour change: `any` is an alias for `interface{}`.
CHANGELOG.md conflicted with #500's entry: both added an Unreleased section at the same line. Resolved by keeping both, one `### Added` and one `### Fixed`, in Keep a Changelog order. No content dropped from either side. release.yml merged without conflict — #500 touched the job graph's `needs:`, this branch touched the publish job's steps and permissions.
|
Post-merge note: the one thing this PR could not show on its own run is now measured rather than predicted.
Three things that were arguments in the PR body are now observations:
The probe run was cancelled once the job list was readable, and the branch is deleted. Nothing about it survives in On the same PR run, all 20 of |
CHANGELOG conflict only, and the two sides do not overlap: #500/#501 added ### Added and ### Fixed, this branch adds ### Changed and ### Removed. Resolved by keeping both in Keep a Changelog order (Added, Changed, Removed, Fixed). Verified the result is the exact union of both parents' Unreleased sections.
The release gate was not the CI gate. It was a disjoint set.
ci.ymldefined 16 jobs,release.ymldefined 5, they shared not one job id, andgrep -c workflow_call .github/workflows/*.ymlreturned0in every file.So v0.14.0 was tagged and published without
test,lint,coverage,fuzz-smoke,config-examples,docs-site,sdk-metrics,deploy-manifests,systemd-unit,packaging,modulefiles,labels,install-scriptorrepo-installever having run against it. A PR merged green and a tag cut from that same commit were verified by two different things, and only the smaller one had a say over what reached users.The design, and why it is this one
ci.ymlgains aworkflow_calltrigger.release.ymlgains agatejob that doesuses: ./.github/workflows/ci.yml.The tempting shape — extract the jobs into a new
gate.ymland haveci.ymlcall it too — would have blocked every pull request in the repository, indefinitely, with nothing red to point at. Aworkflow_calljob reports its checks as<caller-job-id> / <called-job-id>, and 19 ofmain's 20 required contexts are pinned as literal bare strings (test,lint,coverage,config-examples,packaging, sixbuild-tags (...), sixcross-build (...), twomodulefiles (...)). Extraction renames all 19 at once; a required context that never arrives is not a failing check, it is an absent one.Making
ci.ymlitself the reusable workflow avoids that entirely: onpushandpull_requestit is still the top-level workflow, so every check name is byte-identical.No branch-protection change is required. Nothing to run, nothing to wedge.
The only renaming happens on the tag run (
gate / test, ...), where nothing is protected.Second defect found on the way
docker-build-pushhad noneeds:at all. On a tag it logged in to ghcr and pushed{{version}},{{major}}.{{minor}},{{major}}andlatestin parallel with everything else — whether the tests passed, and whether the binary build passed. That is precisely the failurerelease.yml's own header documents for v0.10.0's empty release page, except an image, unlike a release page, cannot be un-pulled.The gate is now a dependency of the graph's roots (
build,package-linux,docker-build-push), so every job is transitively gated by construction rather than by whoever adds the next one remembering to.Per-job reasoning
All 16 jobs are in the gate, and that is a decision rather than a default — the long comment at the top of
ci.ymlrecords the check. There is not onegithub.event.*reference in the file; the complete expression set isenv.GO_VERSION_FILE,github.base_ref || ...,github.ref,github.workflow,matrix.*andsecrets.GITHUB_TOKEN, all of which resolve on a tag. Two carry a caveat stated rather than hidden:lintgates on--new-from-merge-base=origin/$base_ref, andbase_refis empty outside a PR, so on a tag the blocking diff is empty. Weaker, not vacuous:golangci-lint config verifyand the whole-repo count still run, and the diff was already gated at the PR. Excluding it would let a lint config that no longer parses reach a release.install-scriptdeliberately fetches the last published release, so on a tag it is one release behind. Still the right job here: it is what catchesscripts/install.shhaving been edited into something that cannot install anything, before that script is what the next release tells users to pipe into a shell.Tests
internal/config/release_gate_test.go, five tests, each verified by mutation (not by prediction):workflow_call:fromci.ymlTestCIWorkflowIsReusableneeds: gatefrombuildTestReleaseIsGatedByCI(also flaggedsecurity-scan)issues: readfrom the callerTestGateCallerGrantsWhatTheGateNeedsmodulefiles'name:TestRequiredChecksStillHaveAJobToReportThemtestjob idTestRequiredChecksStillHaveAJobToReportThemrelease.ymlrestates a ci job idTestReleaseDoesNotRestateTheGateThe permissions test is the non-obvious one: a called workflow's token is derived from the caller's grants and can only be narrowed, never widened, so a missing
issues: readdoes not fail the run — it handslabelsa token that quietly cannot list labels, and the job then reports on a skip.Two traps hit for real while writing this
name:meant renamingmodulefiles'name:still matched on the id, and that mutation passed. A job reports undername:when it has one; only one of the two is ever the check name. Fixed in the second commit — and this is exactly why the mutation run is not optional.ci.ymlcomment contained a literal empty expression-brace pair while explaining that expressions interpolate inside comments. That is the one form guaranteed to fail the entire file to parse — no job, no log, andcheck-yamlpasses it.TestWorkflowExpressionsAreValidcaught it. The comment now spells the syntax out instead of demonstrating it.Not in this PR
goreleaser/cosign and SHA-pinning are evaluated separately, so this is mergeable on its own.