Repository navigation
Embed cloudbuild.yaml in cmrel so releases need no checkout - #376
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the embedded Cloud Build configuration changes.
No open issues 🎉
What changed in this PR
This PR embeds Cloud Build configurations in cmrel, removing the need for a local repository checkout and keeping default configurations aligned with the installed binary.
Changes:
- Switches all four Cloud Build commands to embedded configurations by default, while preserving explicit
--cloudbuildoverrides with a warning. - Shares YAML decoding between embedded configurations and file-based overrides.
- Adds configuration parsing and publish pin-placeholder tests, integrates them into
make test, and updates CLI documentation.
| File | Description |
|---|---|
README.md |
Documents the embedded default and development-only override. |
pkg/gcb/gcb.go |
Extracts ParseBuild for shared YAML decoding. |
Makefile |
Adds embedded configuration tests to make test. |
gcb/embed.go |
Embeds the four Cloud Build configurations. |
gcb/embed_test.go |
Tests parsing and the publish fail-closed pin placeholder. |
cmd/cmrel/cmd/stage.go |
Defaults staging to its embedded configuration. |
cmd/cmrel/cmd/publish.go |
Uses the embedded publish configuration and adjusts the pin warning. |
cmd/cmrel/cmd/makestage.go |
Defaults make-based staging to its embedded configuration. |
cmd/cmrel/cmd/cloudbuild.go |
Adds shared loading logic, override warnings, and flag help. |
cmd/cmrel/cmd/bootstrap_pgp.go |
Defaults PGP bootstrapping to its embedded configuration. |
Review effort: Balanced
|
This PR worked in the v1.22.0-alpha.0 release. I published it with a We tested it stacked with #377 and #431 on the branch Evidence from the release
What this release did not test
[with Claude] |
SgtCoDFish
left a comment
There was a problem hiding this comment.
/lgtm
/approve
Glorious, wanted to see this for a while 🚀
cmrel stage, makestage, publish and bootstrap-pgp read their Cloud Build config from ./gcb/<cmd>/cloudbuild.yaml, so a release manager had to run cmrel from a checkout of this repository. Since cert-manager#334 the publish job also pins its own cmrel install to the commit the invoking binary was built from, which means the checkout and the binary have to match exactly, and nothing checks that they do. A stale checkout submits the wrong config silently. Building from the checkout instead is fragile too: Go marks the binary as modified if git status shows anything, including untracked files, and the pin then refuses to run. Embed the four configs in the binary. The config is now bound to the same commit as the pin, so `go install github.com/cert-manager/release/cmd/cmrel@<ref>` is the whole install procedure. --cloudbuild stays as an override for cmrel development and defaults to the embedded config. The tests fail if an embedded config stops parsing or if the publish config loses its fail-closed _RELEASE_REPO_REF placeholder. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Richard Wall <[email protected]>
- README: say that cmrel development needs --cloudbuild, because an installed cmrel ignores edits to the files in gcb/. - publish: fail before submitting when --skip-cmrel-pin is set and _RELEASE_REPO_REF is still the placeholder. Previously the job failed inside GCB. - Correct the --cloudbuild help. Only publish pins cmrel, so the help no longer claims that every config matches a pinned commit. - Log when the embedded config is used, so a release log records it. - loadCloudBuild always returns a non-nil Substitutions map. A config with no substitutions block used to cause a nil map panic. - Embed the configs as strings so that importers cannot modify them. - Say in the CloudBuildFile comments that empty means embedded. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Richard Wall <[email protected]>
68b878f to
26e20c9
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: SgtCoDFish The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cmrelnow carries its own Cloud Build configs, so a release manager only needsgo install. No checkout of this repository is required, and there is nothing to keep in sync with the binary.Why
The four commands that submit GCB jobs (
stage,makestage,publish,bootstrap-pgp) read./gcb/<cmd>/cloudbuild.yamlfrom the working directory. Since #334,publishalso pins the GCBcmrelinstall to the commit the invoking binary was built from. So the binary and the checkout must match exactly, and nothing checks that they do. The two ways to get there today both have a trap:go install cmrel@<tag>plusgit checkout <tag>git checkout masterand build from itvcs.modified=trueifgit statusshows anything, including untracked files. The pin then refuses to run.This came out of the v1.21.2 release: cert-manager/cert-manager#9237 (comment)
What changes
gcbat the repo root embeds the fourcloudbuild.yamlfiles withgo:embed.--cloudbuilddefaults to empty, meaning the embedded config. Passing a path still works and logs a warning, so cmrel development against a modified YAML (for example Mint GitHub tokens for publish through octo-sts instead of a stored PAT #373) is unaffected.pkg/gcb.ParseBuildis split out ofLoadBuildso both paths share the decoder._RELEASE_REPO_REFplaceholder.make testnow runs./gcb.The KMS-encrypted token blob in
publish/cloudbuild.yamlis already public in this repository, so embedding it in the binary does not change what is exposed.After this merges
The release process docs shrink to one line, with no clone step:
@masterresolves through the module proxy to a pseudo-version, whichpkg/releaserefalready accepts, so GCB installs that exact commit. I will open the website PR once this is in.Evidence: untracked files break the build-from-checkout path
Built from a clean
mastercheckout that had one untracked directory:pkg/releaseref.Resolverejects that binary: https://github.com/cert-manager/release/blob/v1.13.0/pkg/releaseref/releaseref.go#L61-L66Testing
[Claude Fable 5.1]