Skip to content

Commit f46ac9f

Browse files
jeroptekton-robot
authored andcommitted
TEP-0090: Matrix - Add example and document expected PipelineRun status
[TEP-0090: Matrix][tep-0090] proposed executing a `PipelineTask` in parallel `TaskRuns` and `Runs` with substitutions from combinations of `Parameters` in a `Matrix`. Milestone 1 of the implementation plan - fan out `PipelineTasks` with `Tasks` into `TaskRuns` - is completed. In this change, we add an example `PipelineRun` with a `Matrix` and document the expected status of the `PipelineRun` upon completion. [tep-0090]: https://github.com/tektoncd/community/blob/main/teps/0090-matrix.md
1 parent 5375e76 commit f46ac9f

File tree

2 files changed

+144
-4
lines changed

2 files changed

+144
-4
lines changed

docs/matrix.md

Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ Documentation for specifying `Matrix` in a `Pipeline`:
3131
> :seedling: **`Matrix` is an [alpha](install.md#alpha-features) feature.**
3232
> The `enable-api-fields` feature flag must be set to `"alpha"` to specify `Matrix` in a `PipelineTask`.
3333
> The `embedded-status` feature flag must be set to `"minimal"` to specify `Matrix` in a `PipelineTask`.
34-
>
35-
> :warning: This feature is in a preview mode.
36-
> It is still in a very early stage of development and is not yet fully functional.
3734
3835
## Configuring a Matrix
3936

@@ -193,6 +190,8 @@ spec:
193190
name: platform-browsers
194191
```
195192
193+
When the above `PipelineRun` is executed, these are the `TaskRuns` that are created:
194+
196195
```shell
197196
$ tkn taskruns list
198197
@@ -206,4 +205,106 @@ matrixed-pr-6lvzk-platforms-and-browsers-3 13 seconds ago 7 seconds Succe
206205
matrixed-pr-6lvzk-platforms-and-browsers-1 13 seconds ago 8 seconds Succeeded
207206
matrixed-pr-6lvzk-platforms-and-browsers-2 13 seconds ago 8 seconds Succeeded
208207
matrixed-pr-6lvzk-platforms-and-browsers-0 13 seconds ago 8 seconds Succeeded
209-
```
208+
```
209+
210+
When the above `Pipeline` is executed, its status is populated with `ChildReferences` of the above `TaskRuns`. The
211+
`PipelineRun` status tracks the status of all the fanned out `TaskRuns`. This is the `PipelineRun` after completing
212+
successfully:
213+
214+
```yaml
215+
apiVersion: tekton.dev/v1beta1
216+
kind: PipelineRun
217+
metadata:
218+
generateName: matrixed-pr-
219+
labels:
220+
tekton.dev/pipeline: matrixed-pr-6lvzk
221+
name: matrixed-pr-6lvzk
222+
namespace: default
223+
spec:
224+
pipelineSpec:
225+
tasks:
226+
- matrix:
227+
- name: platform
228+
value:
229+
- linux
230+
- mac
231+
- windows
232+
- name: browser
233+
value:
234+
- chrome
235+
- safari
236+
- firefox
237+
name: platforms-and-browsers
238+
taskRef:
239+
kind: Task
240+
name: platform-browsers
241+
serviceAccountName: default
242+
timeout: 1h0m0s
243+
status:
244+
pipelineSpec:
245+
tasks:
246+
- matrix:
247+
- name: platform
248+
value:
249+
- linux
250+
- mac
251+
- windows
252+
- name: browser
253+
value:
254+
- chrome
255+
- safari
256+
- firefox
257+
name: platforms-and-browsers
258+
taskRef:
259+
kind: Task
260+
name: platform-browsers
261+
startTime: "2022-06-23T23:01:11Z"
262+
completionTime: "2022-06-23T23:01:20Z"
263+
conditions:
264+
- lastTransitionTime: "2022-06-23T23:01:20Z"
265+
message: 'Tasks Completed: 1 (Failed: 0, Cancelled 0), Skipped: 0'
266+
reason: Succeeded
267+
status: "True"
268+
type: Succeeded
269+
childReferences:
270+
- apiVersion: tekton.dev/v1beta1
271+
kind: TaskRun
272+
name: matrixed-pr-6lvzk-platforms-and-browsers-4
273+
pipelineTaskName: platforms-and-browsers
274+
- apiVersion: tekton.dev/v1beta1
275+
kind: TaskRun
276+
name: matrixed-pr-6lvzk-platforms-and-browsers-6
277+
pipelineTaskName: platforms-and-browsers
278+
- apiVersion: tekton.dev/v1beta1
279+
kind: TaskRun
280+
name: matrixed-pr-6lvzk-platforms-and-browsers-2
281+
pipelineTaskName: platforms-and-browsers
282+
- apiVersion: tekton.dev/v1beta1
283+
kind: TaskRun
284+
name: matrixed-pr-6lvzk-platforms-and-browsers-1
285+
pipelineTaskName: platforms-and-browsers
286+
- apiVersion: tekton.dev/v1beta1
287+
kind: TaskRun
288+
name: matrixed-pr-6lvzk-platforms-and-browsers-7
289+
pipelineTaskName: platforms-and-browsers
290+
- apiVersion: tekton.dev/v1beta1
291+
kind: TaskRun
292+
name: matrixed-pr-6lvzk-platforms-and-browsers-0
293+
pipelineTaskName: platforms-and-browsers
294+
- apiVersion: tekton.dev/v1beta1
295+
kind: TaskRun
296+
name: matrixed-pr-6lvzk-platforms-and-browsers-8
297+
pipelineTaskName: platforms-and-browsers
298+
- apiVersion: tekton.dev/v1beta1
299+
kind: TaskRun
300+
name: matrixed-pr-6lvzk-platforms-and-browsers-3
301+
pipelineTaskName: platforms-and-browsers
302+
- apiVersion: tekton.dev/v1beta1
303+
kind: TaskRun
304+
name: matrixed-pr-6lvzk-platforms-and-browsers-5
305+
pipelineTaskName: platforms-and-browsers
306+
```
307+
308+
To execute this example yourself, run [`PipelineRun` with `Matrix`][pr-with-matrix].
309+
310+
[pr-with-matrix]: ../examples/v1beta1/pipelineruns/alpha/pipelinerun-with-matrix.yaml
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: Task
3+
metadata:
4+
name: platform-browsers
5+
annotations:
6+
description: |
7+
A task that does something cool with platforms and browsers
8+
spec:
9+
params:
10+
- name: platform
11+
- name: browser
12+
steps:
13+
- name: echo
14+
image: alpine
15+
script: |
16+
echo "$(params.platform) and $(params.browser)"
17+
---
18+
apiVersion: tekton.dev/v1beta1
19+
kind: PipelineRun
20+
metadata:
21+
generateName: matrixed-pr-
22+
spec:
23+
serviceAccountName: 'default'
24+
pipelineSpec:
25+
tasks:
26+
- name: platforms-and-browsers
27+
matrix:
28+
- name: platform
29+
value:
30+
- linux
31+
- mac
32+
- windows
33+
- name: browser
34+
value:
35+
- chrome
36+
- safari
37+
- firefox
38+
taskRef:
39+
name: platform-browsers

0 commit comments

Comments
 (0)