Skip to content

Commit b333fa0

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 aa1bd39 commit b333fa0

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

teps/0090-matrix.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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,15 +207,13 @@ 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. Configuring the `TaskRuns` or `Runs` created in a given `matrix` to execute sequentially. This remains an option
210+
1. Configuring the `TaskRuns` or `Runs` created in a given `matrix` to execute sequentially. This remains an option
212211
that we can explore later.
213-
3. Excluding generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This remains an option we can
212+
2. Excluding generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This remains an option we can
214213
explore later if needed.
215-
4. Including generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This can be handled by adding
214+
3. Including generating a `TaskRun` or `Run` for a specific combination in the `matrix`. This can be handled by adding
216215
the items that produce that combination into the `matrix`. This remains an option we can explore later if needed.
217-
5. Supporting producing `Results` from fanned out `PipelineTasks`. We plan to address this after [TEP-0075][tep-0075]
216+
4. Supporting producing `Results` from fanned out `PipelineTasks`. We plan to address this after [TEP-0075][tep-0075]
218217
and [TEP-0076][tep-0076] have landed.
219218

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

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

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

0 commit comments

Comments
 (0)