feat(release): step control flags for hashrelease and release build/publish#12615
Open
radTuti wants to merge 5 commits intoprojectcalico:masterfrom
Open
feat(release): step control flags for hashrelease and release build/publish#12615radTuti wants to merge 5 commits intoprojectcalico:masterfrom
radTuti wants to merge 5 commits intoprojectcalico:masterfrom
Conversation
Adds per-step control flags that gate logical release steps in build and publish commands. Factory flag pattern allows context-appropriate defaults and env vars per command. Mirror of calico-private changes (OSS subset).
- Gate updateHelmChartIndex on r.helmIndex instead of r.helmCharts - Gate buildReleaseTar on r.tarball (was unconditional) - Limit publishStepFlags to publish-only concerns, using envPublish* sources so PUBLISH_IMAGES / PUBLISH_CHARTS are honored again - Narrow OCP-bundle precheck to hashrelease, where --manifests actually gates the manifest copy step - Rename --operator env source to RELEASE_OPERATOR for consistency with other RELEASE_* step control vars - Switch hashreleasePublishFlags to productFlags and drop dead gitFlags - Register skipBranchCheckFlag on releaseBuildFlags; pass WithValidate / WithReleaseBranchValidation unconditionally in the release build action, matching hashrelease build - Drop skipValidationFlag from releasePublishFlags (unreferenced)
Previously most step-control flags only gated the collect-to-upload-dir step; the underlying build steps ran unconditionally, so setting --X=false did not save build time and the artifact still landed in the release tarball. Make each flag honest at the build site: - BuildHelm: gate chart build on --helm-charts; gate index build on --helm-index. Skipping charts implicitly skips the index. - buildBinaries: early-return on --binaries=false, independent of the existing --images fast-path. - buildOCPBundle: gate on --ocp-bundle. - Hashrelease windows targets in Build(): gate on --windows-archive. - buildReleaseTar: gate the manifests copy on --manifests and the binaries copy on --binaries (previously both unconditional). Refactor the hashrelease manifests/OCP dependency into a single buildManifests step. Manifests regen and OCP build now live together under one deferred resetManifests at Build() scope so downstream consumers (collectManifests, buildReleaseTar) still see the regenerated pinned manifests. resetManifests is self-guarded on r.manifests so it becomes a no-op when nothing was regenerated. Remove --helm-index from hashrelease publish: PublishRelease for hashrelease routes through publishToHashreleaseServer and never hits updateHelmChartIndex. Teach ReformatHashrelease to tolerate missing artifacts: the post-build reformatter hardcoded copies of calico-windows-*.zip, ocp.tgz, and per-chart tarballs. When step-control flags skip any of those artifacts the copy failed with open ... no such file or directory. Introduce a copyIfExists helper that skips (with an info log) when the source is missing so the reformatter follows the same honor-the-flags discipline as the build steps above.
[DE-4116] - Default-on bool flags use cli.BoolWithInverseFlag (--no-foo form). - Skip-* flags renamed to positive: --validate, --validate-branch, --image-scan. Old SKIP_* env vars dropped. - Builders (images, archive-images, helm-charts, helm-index, windows-archive, operator) take env-var lists per command. Legacy aliases (ARCHIVE_IMAGES, UPDATE_HELM_INDEX, PUBLISH_GIT_TAG) listed first so existing CI wins precedence. - New hashrelease build gates: --e2e-binaries, --release-notes. - Cross-flag invariants on the prerequisite flag's Action. - Drop redundant archive-images runtime guard (urfave/cli v3.8.0 runs Action for env-set flags -- urfave/cli#2221). - Add release/cmd/flags_test.go.
48a3385 to
5023b54
Compare
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.
Adds a unified set of step-control flags to
hashrelease build/publishandrelease build/publishso operators can skip individual build/publish steps (manifests, OCP bundle, helm charts, helm index, binaries, windows archive, images, tarball) from the CLI or via env vars. Every flag is honored at its actual build site in the Manager rather than being validated and ignored, and post-build reformatters tolerate skipped artifacts.Also tightens flag parity between
hashreleaseandrelease(sharedproductFlags, consistentBUILD_*/PUBLISH_*andRELEASE_*env var prefixes, removal of a dead--helm-indexon hashrelease publish, and a missing--skip-branch-checkonrelease build).Default-on bool flags now use
cli.BoolWithInverseFlag, so users can write--no-imagesinstead of--images=false. The development--skip-*flags are renamed to positive defaults:--validate,--validate-branch,--image-scan; the oldSKIP_*env vars are dropped. Builders forimages,archive-images,helm-charts,helm-index,windows-archive, andoperatortake per-command env var lists frombuildStepFlags/publishStepFlagsso build vs publish can disagree (e.g.BUILD_CONTAINER_IMAGESvsPUBLISH_IMAGES); legacy aliases likeARCHIVE_IMAGES,UPDATE_HELM_INDEX, andPUBLISH_GIT_TAGare listed first inSourcesso existing CI configs keep winning precedence. New gates--e2e-binariesand--release-notesare added tohashrelease build. Cross-flag invariants are enforced via flagActioncallbacks on the prerequisite flag (so they fire when the user toggles only the prerequisite). The duplicate archive-images runtime guard is dropped now that urfave/cli v3.8.0 runsActionreliably for env-set flags (urfave/cli#2221).release/cmd/flags_test.gocovers the cross-flag Actions.Release note: