Skip to content

feat: add structured JSON/YAML output for describe commands - #3243

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

feat: add structured JSON/YAML output for describe commands#3243
ankrsinha wants to merge 1 commit into
tektoncd:mainfrom
ankrsinha:feat/describe-structured-output

Conversation

@ankrsinha

@ankrsinha ankrsinha commented Sep 11, 2026

Copy link
Copy Markdown

Changes

Add --output json and --output yaml support to all nine tkn describe commands:

  • pipeline, task, pipelinerun, taskrun, customrun
  • eventlistener, triggerbinding, triggertemplate, clustertriggerbinding
  • Structured output returns a typed resource object with apiVersion and kind via shared helpers in pkg/formatted (IsStructured, SetTypeMeta, PrintStructuredOutput).

Preserved behavior:

  • Human-readable output when -o is omitted
  • -o name, -o jsonpath, and eventlistener -o url

For pipelinerun, taskrun, and customrun with --last, structured output now returns an error on stderr when no runs exist instead of writing human text to stdout.

Also updates command examples, generated docs, man pages, and adds unit tests with golden files.

Submitter Checklist

  • 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

Release Notes

Add `--output json` and `--output yaml` to list commands for pipelines, tasks, pipeline runs, task runs, event listeners, trigger bindings, cluster trigger bindings, trigger templates, and custom runs.

Add -o json and -o yaml to describe for pipelines, tasks, pipeline runs,
task runs, custom runs, event listeners, trigger bindings, trigger
templates, and cluster trigger bindings. Uses typed resource objects with
apiVersion and kind.

Keep -o name, jsonpath, and eventlistener url unchanged. Fix --last on
pipelinerun, taskrun, and customrun so structured output errors when no
runs exist instead of writing human text to stdout. Update examples,
docs, man pages, and tests.

Signed-off-by: Ankur Sinha <anksinha@redhat.com>
Assisted-by: Claude Opus 4.6
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 11, 2026
@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 pratap0007 after the PR has been reviewed.
You can assign the PR to them by writing /assign @pratap0007 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 the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 11, 2026
@ankrsinha

Copy link
Copy Markdown
Author

/hold

Note: This PR depends on pkg/formatted/output.go and pkg/formatted/output_test.go which are shared with the list PR. Please merge list PR first; after that will rebase and the shared-file diff should go away.

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 11, 2026
@ankrsinha
ankrsinha marked this pull request as draft September 11, 2026 14:05
@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

2 participants