Skip to content

Commit c76d569

Browse files
committed
TEP-0090: Matrix - Failure Strategies
[TEP-0090: Matrix][tep-0090] proposed executing a `PipelineTask` in parallel `TaskRuns` and `Runs` with substitutions from combinations of `Parameters` in a `Matrix`. In this change, we propose a fail-fast stategy for handling failures in `TaskRuns` and `Runs` created from a `Matrix`. This makes it easier to control the execution of the many `TaskRuns` or `Runs` created from a `Matrix` - up to 256. This approach also aligns with the default behavior of `Matrix` in other Continuous Delivery systems e.g [GitHub Actions][ghm-failfast]. If needed, we can explore supporting other failure strategies later. [tep-0090]: https://github.com/tektoncd/community/blob/main/teps/0090-matrix.md [ghm-failfast]: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#handling-failures
1 parent ca370d5 commit c76d569

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

teps/0090-matrix.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
status: implementable
33
title: Matrix
44
creation-date: '2021-10-13'
5-
last-updated: '2022-02-14'
5+
last-updated: '2022-06-09'
66
authors:
77
- '@jerop'
88
- '@pritidesai'
@@ -42,6 +42,7 @@ see-also:
4242
- [Alternatives](#alternatives)
4343
- [Fan Out](#fan-out)
4444
- [Concurrency Control](#concurrency-control)
45+
- [Failure Strategies](#failure-strategies)
4546
- [Design](#design)
4647
- [Parameters](#parameters)
4748
- [Substituting String Parameters in the Tasks](#substituting-string-parameters-in-the-tasks)
@@ -206,18 +207,16 @@ specified in a `matrix`.
206207

207208
The following are out of scope for this TEP:
208209

209-
1. Terminating early when one of the `TaskRuns` or `Runs` created in parallel fails. As is currently, running `TaskRuns`
210-
and `Runs` have to complete execution before termination.
211-
2. Controlling the concurrency of `TaskRuns` or `Runs` created in a given `matrix`. This will be addressed more broadly
210+
1. Controlling the concurrency of `TaskRuns` or `Runs` created in a given `matrix`. This will be addressed more broadly
212211
in Tekton Pipelines ([tektoncd/pipeline: issue#2591][issue-2591], [tektoncd/experimental: issue#804][issue-804]).
213-
3. Configuring the `TaskRuns` or `Runs` created in a given `matrix` to execute sequentially. This remains an option that
212+
2. Configuring the `TaskRuns` or `Runs` created in a given `matrix` to execute sequentially. This remains an option that
214213
we can explore later.
215-
4. Excluding generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This can be handled using
214+
3. Excluding generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This can be handled using
216215
guarded execution through `when` expressions. This remains an option we can explore later if needed.
217-
5. Including generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This can be handled by adding
216+
4. Including generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This can be handled by adding
218217
the items that produce that combination into the `matrix`, and using guarded execution through `when` expressions to
219218
exclude the combinations that should be skipped. This remains an option we can explore later if needed.
220-
6. Supporting producing `Results` from fanned out `PipelineTasks`. We plan to address this after [TEP-0075][tep-0075]
219+
5. Supporting producing `Results` from fanned out `PipelineTasks`. We plan to address this after [TEP-0075][tep-0075]
221220
and [TEP-0076][tep-0076] have landed.
222221

223222
### Requirements
@@ -721,6 +720,18 @@ If needed, we can also explore providing more granular controls for maximum numb
721720
or `Runs` from `Matrices` - either at `PipelineRun`, `Pipeline` or `PipelineTask` levels - later.
722721
This is an option we can pursue after gathering user feedback - it's out of scope for this TEP.
723722

723+
### Failure Strategies
724+
725+
In failure scenarios, the `TaskRuns` or `Runs` created from a `Matrix` will fail fast. That is, when
726+
any `TaskRun` or `Run` from a given fanned-out `PipelineTask` fails or is cancelled then the other
727+
`TaskRuns` or `Runs` from the same `PipelineTask` will be cancelled.
728+
729+
This approach makes it easier to control the execution of the many `TaskRuns` or `Runs` that can be
730+
created from a `Matrix` (up to 256 for now). Moreover, failing fast is the default behavior of `Matrix`
731+
in other Continuous Delivery systems - see [GitHub Actions - Handling Failures in Matrix][ghm-failfast].
732+
733+
If needed, we can explore supporting other failure strategies later.
734+
724735
## Design
725736

726737
In this section, we go into the details of the `Matrix` in relation to:
@@ -1650,4 +1661,5 @@ However, this approach has the following disadvantages:
16501661
[git-clone]: https://github.com/tektoncd/catalog/tree/main/task/git-clone/0.5
16511662
[when]: https://github.com/tektoncd/pipeline/blob/6cb0f4ccfce095495ca2f0aa20e5db8a791a1afe/docs/pipelines.md#guard-task-execution-using-when-expressions
16521663
[retries]: https://github.com/tektoncd/pipeline/blob/6cb0f4ccfce095495ca2f0aa20e5db8a791a1afe/docs/pipelines.md#using-the-retries-parameter
1653-
[timeouts]: https://github.com/tektoncd/pipeline/blob/6cb0f4ccfce095495ca2f0aa20e5db8a791a1afe/docs/pipelines.md#configuring-the-failure-timeout
1664+
[timeouts]: https://github.com/tektoncd/pipeline/blob/6cb0f4ccfce095495ca2f0aa20e5db8a791a1afe/docs/pipelines.md#configuring-the-failure-timeout
1665+
[ghm-failfast]: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#handling-failures

teps/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ This is the complete list of Tekton teps:
234234
|[TEP-0086](0086-changing-the-way-result-parameters-are-stored.md) | Changing the way result parameters are stored | proposed | 2022-04-07 |
235235
|[TEP-0088](0088-result-summaries.md) | Tekton Results - Record Summaries | proposed | 2021-10-01 |
236236
|[TEP-0089](0089-nonfalsifiable-provenance-support.md) | Non-falsifiable provenance support | implementable | 2022-01-18 |
237-
|[TEP-0090](0090-matrix.md) | Matrix | implementable | 2022-02-14 |
237+
|[TEP-0090](0090-matrix.md) | Matrix | implementable | 2022-06-09 |
238238
|[TEP-0092](0092-scheduling-timeout.md) | Scheduling Timeout | implementable | 2022-04-11 |
239239
|[TEP-0094](0094-configuring-resources-at-runtime.md) | Configuring Resources at Runtime | implemented | 2022-03-11 |
240240
|[TEP-0095](0095-common-repository-configuration.md) | Common Repository Configuration | proposed | 2021-11-29 |

0 commit comments

Comments
 (0)