feat: shp buildrun gather subcommand to extract the details of the failed BuildRun#380
feat: shp buildrun gather subcommand to extract the details of the failed BuildRun#380kaizakin wants to merge 3 commits intoshipwright-io:mainfrom
Conversation
|
@kaizakin: The label(s) DetailsIn response to this:
Instructions 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 |
c761cbd to
8307693
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new shp buildrun gather subcommand to collect BuildRun diagnostics (BuildRun/TaskRun/Pod objects + pod logs) into a directory or .tar.gz archive, to help debug failed BuildRuns (Fixes #250).
Changes:
- Add a
dynamic.Interfaceclient to CLI params for fetching Tekton objects. - Introduce
shp buildrun gathersubcommand with--outputand--archiveflags to export YAMLs and logs. - Add generated CLI docs for the new subcommand and link it from
shp buildrundocs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/shp/params/params.go | Adds dynamic client support for retrieving Tekton resources (TaskRuns). |
| pkg/shp/cmd/buildrun/gather.go | Implements the new gather subcommand, YAML/log collection, and optional tar.gz archiving. |
| pkg/shp/cmd/buildrun/buildrun.go | Registers gather under the buildrun command group. |
| docs/shp_buildrun_gather.md | Adds generated documentation for shp buildrun gather. |
| docs/shp_buildrun.md | Links the new gather subcommand in the BuildRun command index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func (c *GatherCommand) Run(p *params.Params, ioStreams *genericclioptions.IOStreams) error { | ||
| ctx := c.cmd.Context() | ||
| namespace := p.Namespace() | ||
|
|
||
| shpClient, err := p.ShipwrightClientSet() | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| kubeClient, err := p.ClientSet() | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| buildRun, err := shpClient.ShipwrightV1beta1().BuildRuns(namespace).Get(ctx, c.name, metav1.GetOptions{}) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to get BuildRun %q: %w", c.name, err) | ||
| } |
There was a problem hiding this comment.
New gather functionality isn’t covered by unit tests. Other BuildRun subcommands in this package (e.g. cancel, logs) have tests, so it would be good to add tests for at least: writing buildrun/taskrun/pod YAML, handling missing TaskRun/Pod, and --archive path behavior.
IrvingMg
left a comment
There was a problem hiding this comment.
Thanks for the PR @kaizakin!
I have a few suggestions for the first pass:
- Please address Copilot’s review comments.
- Fix the linter issues reported by CI.
- Feel free to squash the commits as well.
Regarding your questions:
- IIUC, supporting
PipelineRunwould add more complexity. So, in my opinion, it would be better to keep this PR focused onBuildRun, but I’d like to hear others’ opinions. - It would be nice to have unit tests, at least for basic scenarios.
8307693 to
41b15f6
Compare
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
41b15f6 to
dbc1236
Compare
Changes
buildruntaskrunpodObjects and individual pod logs--outputflag determines the output location, default value is.currect directory.--archiveflag determines the output to be compressed as.tar.gzEdit:
gathernow supportsPipelineRunexecutor as welldynamicClientand extendedWithClientsetNewParamsForTestto supportdynamicClientFixes #250
Type of PR
/kind feature
Submitter Checklist
2026-03-22.20-23-03.mp4
Release Notes