Embed cloudbuild.yaml in cmrel so releases need no checkout - #376
Open
wallrj wants to merge 1 commit into
Open
Conversation
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]>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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]