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 4 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.
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
41b15f6 to
dbc1236
Compare
|
requesting review @IrvingMg |
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
f89a76b to
b14b390
Compare
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
b14b390 to
d3e65e2
Compare
|
Thanks for the review @IrvingMg |
| return err | ||
| } | ||
|
|
||
| for _, container := range append(pod.Spec.InitContainers, pod.Spec.Containers...) { |
There was a problem hiding this comment.
Looks like this block can be commonized since it’s duplicated in gatherPipelineRunExecutor. Please also check if there’s any other duplication we can commonize.
|
|
||
| // Validate validates data input by user | ||
| func (c *GatherCommand) Validate() error { | ||
| if c.name == "" { |
There was a problem hiding this comment.
Don’t we need some naming format? It looks like we currently support any non-whitespace string. This would likely fail on the server side at some point, but we could validate it earlier. WDYT?
| func resolvePodForTaskRun(ctx context.Context, client kubernetes.Interface, namespace string, taskRunName string, podName string) (*corev1.Pod, error) { | ||
| if podName != "" { | ||
| pod, err := client.CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{}) | ||
| switch { |
There was a problem hiding this comment.
Do we really need this switch here?
| defer file.Close() | ||
|
|
||
| gzipWriter := gzip.NewWriter(file) | ||
| defer gzipWriter.Close() |
There was a problem hiding this comment.
I think we need to revisit the error handling in this function. For example,here it looks like if something fails, we could end up with a corrupted archive, so we might want to clean it up instead. Please double-check if the error handling is correct here.
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
TaskRun
2026-03-22.20-23-03.mp4
PipelineRun
2026-03-31.02-28-01.mp4
Release Notes