Skip to content

feat: add structured JSON/YAML output for delete command - #3318

Open
ankrsinha wants to merge 1 commit into
tektoncd:mainfrom
ankrsinha:feat/structured-output-delete
Open

ankrsinha wants to merge 1 commit into
tektoncd:mainfrom
ankrsinha:feat/structured-output-delete

Conversation

@ankrsinha

@ankrsinha ankrsinha commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2850

Changes

Add --output json/yaml (-o) structured output support for delete
command (by name, without bulk flags) 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

Example:

$ tkn task delete foo bar -n ns -o json
{
    "deleted": [
        "foo",
        "bar"
    ]
} 
$ tkn task delete foo -n ns -o yaml
deleted:
- foo
  • Output structure is the same for all resources.
  • Bulk delete with flags like --all, --keep, --trs, --prs is
    not in scope and will be a follow-up.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

Add --output json/yaml support for delete commands across
task, pipeline, pipelinerun, customrun, eventlistener,
triggerbinding, triggertemplate, and clustertriggerbinding.

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>
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign divyansh42 after the PR has been reviewed.
You can assign the PR to them by writing /assign @divyansh42 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 30, 2026
@chmouel

chmouel commented Sep 30, 2026

Copy link
Copy Markdown
Member

Thanks for adding structured output to delete. I found a few paths that still need attention: --all and pipelinerun delete --pipeline can print plain text with -o json or -o yaml; pipeline delete --prs and task delete --trs leave the related runs out of the result; and a later deletion error can hide resources already deleted, including CustomRuns. Could the structured result include every successful deletion, even when the command also returns an error?

@ankrsinha

Copy link
Copy Markdown
Contributor Author

@chmouel Thanks for the review and for catching these.

--all and pipelinerun delete --pipeline can print plain text with -o json or -o yaml

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.

pipeline delete --prs and task delete --trs leave the related runs out of the result; and a later deletion error can hide resources already deleted, including CustomRuns. Could the structured result include every successful deletion, even when the command also returns an error?

Agreed on this, i will update the PR for handling these two issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants