feat(release): Enhance build and publish workflows#4473
feat(release): Enhance build and publish workflows#4473radTuti wants to merge 8 commits intotigera:masterfrom
Conversation
add a generic, extensible hook system to the release tooling that allows external code to extend build and publish workflows without modifying core logic.
48e2f7b to
ac32634
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements an extensible hook system to enhance the build and publish workflows for the release tooling. The changes enable external code to extend workflow behavior without modifying core logic, add support for cloning product repositories at specific git hashes for hashrelease builds when local directories aren't provided, and change the default behavior to create GitHub releases during publish operations.
Changes:
- Introduced a comprehensive hook system with timeout support for extending build and publish workflows
- Added automatic git-based repository cloning for hashrelease builds when product directories aren't specified
- Changed default GitHub release creation behavior from opt-in to opt-out
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| hack/release/hooks.go | New hook system implementation with timeout and error handling |
| hack/release/hooks_test.go | Comprehensive tests for hook system including timeout and error scenarios |
| hack/release/build.go | Integrated hook system, added hashrelease repo cloning, refactored cleanup to use hooks |
| hack/release/build_test.go | Tests for git hash extraction from version strings |
| hack/release/publish.go | Integrated publish hooks, refactored to return publish status |
| hack/release/utils.go | Added context-aware command execution, made version validator overridable |
| hack/release/utils_test.go | Tests for context-aware commands and version validator override |
| hack/release/flags.go | Added hook timeout, git repo/branch flags, changed GitHub release default to true |
| hack/release/checks.go | Updated to use overridable version validator |
| hack/release/prep.go | Updated modifyComponentImageConfig call signature |
| Makefile | Removed explicit CREATE_GITHUB_RELEASE=true (now default) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // runCommandInDirContext is a context-aware variant of runCommandInDir. | ||
| // When ctx is cancelled, the entire process group is killed to ensure child processes are cleaned up. | ||
| func runCommandInDirContext(ctx context.Context, dir, name string, args, env []string) (string, error) { |
There was a problem hiding this comment.
We're starting to have so many runCommandX type functions that I wonder if we should just have one command that we pass Option()s to, like
runCommand(
cmd.WithCommand("blah"),
cmd.InDir("dir"),
cmd.WithContext(ctx),
cmd.WithEnv(env)
)Otherwise, it might make sense to have one runCommandInDirWithContextAndOutputAndTimeout(...) command and some simplified wrappers that just pass defaults for whichever fields they don't need (e.g. runCommandInDir() passes a default ctx and timeout and discards output).
Probably not worth it for this PR but I'm not sure how difficult that would be to implement.
There was a problem hiding this comment.
Likely for a different PR to limit the scope for this PR.
- switch phase hook to multiHook - clean up cloning hashrelease repo to use treeless clone instead
Description
This implements and extensible hook system to extend the build and publish workflows. The builds for hashrelease uses the git hash for the corresponding product to generate CRDs when a path to the product directory locally is not set. For release, the publish creates a github release by default unless user overrides it.
Release Note
For PR author
make gen-filesmake gen-versionsFor PR reviewers
A note for code reviewers - all pull requests must have the following:
kind/bugif this is a bugfix.kind/enhancementif this is a a new feature.enterpriseif this PR applies to Calico Enterprise only.