Repository navigation
feat: add structured JSON/YAML output for delete command - #3318
Conversation
|
Thanks for adding structured output to |
|
@chmouel Thanks for the review and for catching these.
This is intentional as this PR does not focus on bulk delete (with flags like --all, --pipeline, --keep). This will be handled in a seperate PR.
Agreed on this, i will update the PR for handling these two issues. |
d8f5d04 to
7c623e9
Compare
|
/lgtm |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Structured-output handling still permits unconfirmed bulk deletion and unreliable failure reporting.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds machine-readable delete results across eight Tekton resource types, advancing #2850. TaskRun support remains separate in #3086.
Changes:
- Adds a shared deletion-result format and successful-deletion accessors.
- Integrates JSON/YAML output, format validation, and prompt suppression.
- Adds tests and updates generated command documentation.
| File | Description |
|---|---|
| pkg/formatted/output.go | Adds the shared deletion-result format. |
| pkg/formatted/output_test.go | Tests result construction and empty lists. |
| pkg/deleter/deleter.go | Exposes successful deletion names. |
| pkg/deleter/deleter_test.go | Tests deletion accessors. |
| pkg/cmd/triggertemplate/delete.go | Adds structured TriggerTemplate results. |
| pkg/cmd/triggertemplate/delete_test.go | Tests formats and validation. |
| pkg/cmd/triggerbinding/delete.go | Adds structured TriggerBinding results. |
| pkg/cmd/triggerbinding/delete_test.go | Tests formats and validation. |
| pkg/cmd/task/delete.go | Adds structured Task and related-deletion results. |
| pkg/cmd/task/delete_test.go | Tests formats and related deletions. |
| pkg/cmd/pipelinerun/delete.go | Adds structured named PipelineRun results. |
| pkg/cmd/pipelinerun/delete_test.go | Tests formats and partial failures. |
| pkg/cmd/pipeline/delete.go | Adds structured Pipeline and related-deletion results. |
| pkg/cmd/pipeline/delete_test.go | Tests formats and related deletions. |
| pkg/cmd/eventlistener/delete.go | Adds structured EventListener results. |
| pkg/cmd/eventlistener/delete_test.go | Tests formats and validation. |
| pkg/cmd/customrun/delete.go | Adds structured results and deletion-error tracking. |
| pkg/cmd/customrun/delete_test.go | Tests JSON, validation, and partial failures. |
| pkg/cmd/clustertriggerbinding/delete.go | Adds structured ClusterTriggerBinding results. |
| pkg/cmd/clustertriggerbinding/delete_test.go | Tests formats and validation. |
| docs/man/man1/tkn-triggertemplate-delete.1 | Updates output options and examples. |
| docs/man/man1/tkn-triggerbinding-delete.1 | Updates output options and examples. |
| docs/man/man1/tkn-task-delete.1 | Updates output options and examples. |
| docs/man/man1/tkn-pipelinerun-delete.1 | Updates output options and examples. |
| docs/man/man1/tkn-pipeline-delete.1 | Updates output options and examples. |
| docs/man/man1/tkn-eventlistener-delete.1 | Updates output options and examples. |
| docs/man/man1/tkn-customrun-delete.1 | Updates output options and examples. |
| docs/man/man1/tkn-clustertriggerbinding-delete.1 | Updates output options and examples. |
| docs/cmd/tkn_triggertemplate_delete.md | Documents JSON/YAML usage. |
| docs/cmd/tkn_triggerbinding_delete.md | Documents JSON/YAML usage. |
| docs/cmd/tkn_task_delete.md | Documents JSON/YAML usage. |
| docs/cmd/tkn_pipelinerun_delete.md | Documents JSON/YAML usage. |
| docs/cmd/tkn_pipeline_delete.md | Documents JSON/YAML usage. |
| docs/cmd/tkn_eventlistener_delete.md | Documents JSON/YAML usage. |
| docs/cmd/tkn_customrun_delete.md | Documents JSON/YAML usage. |
| docs/cmd/tkn_clustertriggerbinding_delete.md | Documents JSON/YAML usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@ankrsinha few minor feedbacks:
|
Add -o json/yaml flag to delete commands for task, pipeline,
pipelinerun, customrun, eventlistener, triggerbinding,
triggertemplate, and clustertriggerbinding resources.
When used, the result is returned as machine-readable output
in the format {"deleted": ["name1", "name2"]}.
Signed-off-by: Ankur Sinha <anksinha@redhat.com>
Assisted-by: Claude Opus 4.6 (via Cursor)
Signed-off-by: Ankur Sinha <anksinha@redhat.com>
7c623e9 to
fe2d4cb
Compare
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: divyansh42 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cc @chmouel @vdemeester |
|
/cc @pratap0007 |
|
/lgtm |


Part of #2850
Changes
Add
--output json/yaml(-o) structured output support for deletecommand across 8 resource types:
task, pipeline, pipelinerun, customrun, eventlistener, triggerbinding,
triggertemplate, and clustertriggerbinding.
TaskRun is excluded (covered by #3086).
When used, the result is returned as machine-readable output.
-o json/-o yamlskips the confirmation prompt (same as-f) so thecommand can run non-interactively.
Example:
--trs/--prsare in scope; relatedresource names are included in the result.
--all,--keep,--pipelineis not inscope yet; combining them with
-oerrors out until a follow-up addsstructured bulk output.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make checkmake generatedSee the contribution guide
for more details.
Release Notes