Skip to content

Add --log-failed flag to pipelinerun logs command#2920

Open
chmouel wants to merge 1 commit into
tektoncd:mainfrom
chmouel:add-log-failed-flag
Open

Add --log-failed flag to pipelinerun logs command#2920
chmouel wants to merge 1 commit into
tektoncd:mainfrom
chmouel:add-log-failed-flag

Conversation

@chmouel

@chmouel chmouel commented Jun 23, 2026

Copy link
Copy Markdown
Member

Changes

Add a --log-failed flag to tkn pipelinerun logs that filters output
to only show logs from failed TaskRuns, similar to how GitHub CLI (gh) shows failed job logs. see https://docs.github.com/en/actions/how-tos/monitor-workflows/use-workflow-run-logs#viewing-logs-with-github-cli

tkn pr logs my-pipeline-run --log-failed

Behavior

  • When --log-failed is set, only TaskRuns with ConditionFalse status are shown
  • When --log-failed is set and the PipelineRun is still running, the completed-logs path is used (skips --follow) so only already-failed TaskRuns appear
  • If no TaskRuns have failed, an informative error is returned
  • Composes with --task flag (intersection of both filters)

Submitter Checklist

Add --log-failed flag to `tkn pipelinerun logs` to show logs for failed tasks only

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jun 23, 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 ask for approval from chmouel after the PR has been reviewed.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 23, 2026
Add a --log-failed flag to `tkn pipelinerun logs` that filters output
to only show logs from failed TaskRuns, similar to how GitHub Actions
shows failed job logs.

When --log-failed is set and the PipelineRun is still running, the
completed-logs path is used so only TaskRuns that have already failed
are shown. If no TaskRuns have failed, an informative error is returned.
The flag composes with --task (intersection of both filters).

Signed-off-by: Chmouel Boudjnah <chmouel@chmouel.com>
Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@chmouel chmouel force-pushed the add-log-failed-flag branch from 645e0bb to ff3075b Compare June 23, 2026 07:57
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants