feat(cmd): add 'update' subcommand for build resources - #413
feat(cmd): add 'update' subcommand for build resources#413mohit-bhandari45 wants to merge 5 commits into
Conversation
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
Signed-off-by: mohit-bhandari45 <mohitbhandari852@gmail.com>
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[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 |
There was a problem hiding this comment.
🟡 Changes recommended
Critical correctness, lint, and generated-documentation issues remain unresolved.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds get commands for Build and BuildRun resources and a selective build update command with tests.
Changes:
- Adds table, JSON, and YAML retrieval.
- Adds flag-based Build updates and not-found handling.
- Registers new commands and adds unit tests.
File summaries
| File | Summary |
|---|---|
pkg/shp/cmd/buildrun/get.go |
Adds BuildRun retrieval; exported methods need revive comments (critical, 1 vote). |
pkg/shp/cmd/buildrun/get_test.go |
Tests BuildRun retrieval output and errors. |
pkg/shp/cmd/buildrun/buildrun.go |
Registers get; generated BuildRun docs are missing (critical, 3 votes). |
pkg/shp/cmd/build/update.go |
Some flags are silently ignored, local sources can be removed, and deprecated aliases skip updates (critical/moderate findings). |
pkg/shp/cmd/build/update_test.go |
Tests successful and missing Build updates. |
pkg/shp/cmd/build/get.go |
Can panic when a Build has no source (critical, 3 votes). |
pkg/shp/cmd/build/get_test.go |
Tests Build output formats and not-found handling. |
pkg/shp/cmd/build/build.go |
Registers commands; generated Build docs are missing (critical, 3 votes). |
Review details
Suppressed comments (2)
pkg/shp/cmd/build/update.go:82
--source-urlis a registered deprecated alias for--source-git-urland writes to the same value, but Cobra tracksChangedseparately for each flag. Using the advertised alias leaves this condition false, so the URL update is silently skipped; includeflags.SourceURLFlagin the changed check.
if c.cmd.Flags().Changed(flags.SourceGitURLFlag) && c.buildSpec.Source != nil && c.buildSpec.Source.Git != nil {
pkg/shp/cmd/build/update.go:94
--source-revisionis a registered deprecated alias for--source-git-revision, but Cobra tracksChangedseparately for each flag. Using that alias leaves this condition false and silently skips the revision update; includeflags.SourceRevisionFlagin the changed check.
if c.cmd.Flags().Changed(flags.SourceGitRevisionFlag) && c.buildSpec.Source != nil && c.buildSpec.Source.Git != nil {
- Files reviewed: 8/8 changed files
- Comments generated: 6
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
closed because of unnecessary changes. |
Changes
Introduced the missing
updatesubcommand forbuildresource manager (shp build update):shp build update <name> [flags]: Allows updating existingBuildobject specifications (e.g.--source-git-url,--source-git-revision,--output-image,--strategy-name,--source-context-dir,--dockerfile,--builder-image, etc.) directly from the CLI.Flags().Changed(...)to only modify specified fields without overwriting un-flagged spec fields.Build 'xyz' not found in namespace 'default'.error message.pkg/shp/cmd/build/update_test.gocovering success andNotFoundcases (100% passing).Related Issue
Fixes #411
Type of PR
/kind feature
Submitter Checklist
Release Notes