Skip to content

fix: propagate PipelineRun tasks/finally timeout to child TaskRuns#9419

Open
infernus01 wants to merge 1 commit intotektoncd:mainfrom
infernus01:timeout-fix
Open

fix: propagate PipelineRun tasks/finally timeout to child TaskRuns#9419
infernus01 wants to merge 1 commit intotektoncd:mainfrom
infernus01:timeout-fix

Conversation

@infernus01
Copy link
Member

@infernus01 infernus01 commented Feb 23, 2026

Changes

When a PipelineRun specifies spec.timeouts.tasks (or spec.timeouts.finally) but no per-task timeout is set via pipeline.spec.tasks[].timeout or pipelineRun.spec.taskRunSpecs[].timeout, the created TaskRun/CustomRun
receives no explicit timeout. The webhook then applies the global default (default-timeout-minutes, typically 1h), causing the TaskRun to be cancelled prematurely by the TaskRun reconciler, even when the PipelineRun allows a longer duration.

This commit propagates the PipelineRun-level tasks/finally timeout to child TaskRuns and CustomRuns when no per-task timeout is explicitly configured and the PipelineRun timeout exceeds the global default. When the PipelineRun timeout is smaller than the default, the PipelineRun's cumulative enforcement handles cancellation.

Timeout precedence (highest to lowest)

  1. pipelineRun.spec.taskRunSpecs[].timeout
  2. pipeline.spec.tasks[].timeout
  3. pipelineRun.spec.timeouts.tasks / pipelineRun.spec.timeouts.finally (when > global default)
  4. Global default (default-timeout-minutes)

fixes: #8539
/kind bug

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

When `spec.timeouts.tasks` or `spec.timeouts.finally` on a PipelineRun exceeds the global default timeout, the value is now propagated to individual child TaskRuns that do not have an explicit per-task timeout. This prevents TaskRuns from being prematurely canceled at the global default (e.g., 1h) when the PipelineRun allows a longer duration.

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Feb 23, 2026
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 23, 2026
if facts.FinalTasksGraph != nil && rpt.IsFinalTask(facts) {
return pr.FinallyTimeout()
}
return pr.TasksTimeout()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PLR.TasksTimeout is overall timeout of all the tasks in a pipelines. Looks like repurpose of the field to use this as default timeout for each task in pipeline ?

@vdemeester do you agree with that ?

Copy link
Member Author

@infernus01 infernus01 Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pramodbindal Yes each task would get this timeout, and even though each TaskRun has an individual timeout set, the total execution will stay within spec.timeouts.tasks .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make any difference to PLR ?
because if task is not completed within that time then Pipelinerun will be timed out. and if PLR is timed out then there is no significance of taskrun.

what if we use some kind of default taskTimeout and if task exceeds this duration then timeout the task instead of PLR. (this default task timeout should less than overall pipeline timeout)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, so when timeouts.tasks is smaller than the default, we shouldn't propagate it. We let the default apply.
For exampel, tasks: 20s, default: 1h --> TaskRun gets 1h. The PipelineRun's cumulative timer cancels it at 20s. because 20s < 1h, so the default never fires before the PipelineRun steps in.

@waveywaves
Copy link
Member

/assign

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from waveywaves 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

@waveywaves
Copy link
Member

/rebase

@tekton-robot
Copy link
Collaborator

Rebase failed: Cannot rebase PRs from forks. The PR branch must be in the same repository.

@infernus01
Copy link
Member Author

/retest

1 similar comment
@infernus01
Copy link
Member Author

/retest

@infernus01
Copy link
Member Author

/test all

@infernus01 infernus01 closed this Feb 25, 2026
@infernus01 infernus01 reopened this Feb 25, 2026
@github-project-automation github-project-automation bot moved this from Done to In Progress in Tekton Community Roadmap Feb 25, 2026
@infernus01
Copy link
Member Author

@vdemeester
Copy link
Member

@infernus01 we need to update the documentation and highlight the change of behavior there as well (and in the release notes also). But I think otherwise, it looks good 👼🏼

@vdemeester vdemeester added this to the v1.11.0 milestone Feb 26, 2026
@vdemeester
Copy link
Member

We should also add that it fixes #8539

Signed-off-by: Shubham Bhardwaj <shubbhar@redhat.com>
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. 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

No open projects
Status: In Progress

Development

Successfully merging this pull request may close these issues.

Set PipelineRun Tasks to inherit their timeout from their PipelineRun's spec.timeouts.pipeline

6 participants