Skip to content

Commit e1fd727

Browse files
chengjoeytekton-robot
authored andcommitted
TEP-0118 matrix: add matrix.params filed
1 parent a70b109 commit e1fd727

37 files changed

+1348
-847
lines changed

docs/matrix.md

Lines changed: 89 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ spec:
101101
...
102102
- name: test
103103
matrix:
104-
- name: platform
105-
value: $(params.platforms)
106-
- name: browser
107-
value: $(params.browsers)
104+
params:
105+
- name: platform
106+
value: $(params.platforms)
107+
- name: browser
108+
value: $(params.browsers)
108109
taskRef:
109110
name: browser-test
110111
...
@@ -134,11 +135,12 @@ spec:
134135
...
135136
- name: test
136137
matrix:
137-
- name: browser
138-
value:
139-
- chrome
140-
- safari
141-
- firefox
138+
params:
139+
- name: browser
140+
value:
141+
- chrome
142+
- safari
143+
- firefox
142144
params:
143145
- name: platform
144146
value: linux
@@ -243,16 +245,17 @@ spec:
243245
tasks:
244246
- name: platforms-and-browsers
245247
matrix:
246-
- name: platform
247-
value:
248-
- linux
249-
- mac
250-
- windows
251-
- name: browser
252-
value:
253-
- chrome
254-
- safari
255-
- firefox
248+
params:
249+
- name: platform
250+
value:
251+
- linux
252+
- mac
253+
- windows
254+
- name: browser
255+
value:
256+
- chrome
257+
- safari
258+
- firefox
256259
taskRef:
257260
name: platform-browsers
258261
```
@@ -291,16 +294,17 @@ spec:
291294
pipelineSpec:
292295
tasks:
293296
- matrix:
294-
- name: platform
295-
value:
296-
- linux
297-
- mac
298-
- windows
299-
- name: browser
300-
value:
301-
- chrome
302-
- safari
303-
- firefox
297+
params:
298+
- name: platform
299+
value:
300+
- linux
301+
- mac
302+
- windows
303+
- name: browser
304+
value:
305+
- chrome
306+
- safari
307+
- firefox
304308
name: platforms-and-browsers
305309
taskRef:
306310
kind: Task
@@ -311,16 +315,17 @@ status:
311315
pipelineSpec:
312316
tasks:
313317
- matrix:
314-
- name: platform
315-
value:
316-
- linux
317-
- mac
318-
- windows
319-
- name: browser
320-
value:
321-
- chrome
322-
- safari
323-
- firefox
318+
params:
319+
- name: platform
320+
value:
321+
- linux
322+
- mac
323+
- windows
324+
- name: browser
325+
value:
326+
- chrome
327+
- safari
328+
- firefox
324329
name: platforms-and-browsers
325330
taskRef:
326331
kind: Task
@@ -392,18 +397,19 @@ spec:
392397
tasks:
393398
- name: platforms-and-browsers
394399
matrix:
395-
- name: type
396-
value:
397-
- "type(1)"
398-
- "type(1.0)"
399-
- name: colors
400-
value:
401-
- "{'blue': '0x000080', 'red': '0xFF0000'}['blue']"
402-
- "{'blue': '0x000080', 'red': '0xFF0000'}['red']"
403-
- name: bool
404-
value:
405-
- "type(1) == int"
406-
- "{'blue': '0x000080', 'red': '0xFF0000'}['red'] == '0xFF0000'"
400+
params:
401+
- name: type
402+
value:
403+
- "type(1)"
404+
- "type(1.0)"
405+
- name: colors
406+
value:
407+
- "{'blue': '0x000080', 'red': '0xFF0000'}['blue']"
408+
- "{'blue': '0x000080', 'red': '0xFF0000'}['red']"
409+
- name: bool
410+
value:
411+
- "type(1) == int"
412+
- "{'blue': '0x000080', 'red': '0xFF0000'}['red'] == '0xFF0000'"
407413
taskRef:
408414
apiVersion: cel.tekton.dev/v1alpha1
409415
kind: CEL
@@ -441,18 +447,19 @@ spec:
441447
pipelineSpec:
442448
tasks:
443449
- matrix:
444-
- name: type
445-
value:
446-
- type(1)
447-
- type(1.0)
448-
- name: colors
449-
value:
450-
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''blue'']'
451-
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red'']'
452-
- name: bool
453-
value:
454-
- type(1) == int
455-
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red''] == ''0xFF0000'''
450+
params:
451+
- name: type
452+
value:
453+
- type(1)
454+
- type(1.0)
455+
- name: colors
456+
value:
457+
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''blue'']'
458+
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red'']'
459+
- name: bool
460+
value:
461+
- type(1) == int
462+
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red''] == ''0xFF0000'''
456463
name: platforms-and-browsers
457464
taskRef:
458465
apiVersion: cel.tekton.dev/v1alpha1
@@ -463,18 +470,19 @@ status:
463470
pipelineSpec:
464471
tasks:
465472
- matrix:
466-
- name: type
467-
value:
468-
- type(1)
469-
- type(1.0)
470-
- name: colors
471-
value:
472-
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''blue'']'
473-
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red'']'
474-
- name: bool
475-
value:
476-
- type(1) == int
477-
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red''] == ''0xFF0000'''
473+
params:
474+
- name: type
475+
value:
476+
- type(1)
477+
- type(1.0)
478+
- name: colors
479+
value:
480+
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''blue'']'
481+
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red'']'
482+
- name: bool
483+
value:
484+
- type(1) == int
485+
- '{''blue'': ''0x000080'', ''red'': ''0xFF0000''}[''red''] == ''0xFF0000'''
478486
name: platforms-and-browsers
479487
taskRef:
480488
apiVersion: cel.tekton.dev/v1alpha1
@@ -541,11 +549,12 @@ spec:
541549
tasks:
542550
- name: matrix-and-params
543551
matrix:
544-
- name: platform
545-
value:
546-
- linux
547-
- mac
548-
- windows
552+
params:
553+
- name: platform
554+
value:
555+
- linux
556+
- mac
557+
- windows
549558
params:
550559
- name: browser
551560
value: chrome

docs/pipeline-api.md

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,40 @@ TaskSpec
11711171
</tr>
11721172
</tbody>
11731173
</table>
1174+
<h3 id="tekton.dev/v1.Matrix">Matrix
1175+
</h3>
1176+
<p>
1177+
(<em>Appears on:</em><a href="#tekton.dev/v1.PipelineTask">PipelineTask</a>)
1178+
</p>
1179+
<div>
1180+
<p>Matrix is used to fan out Tasks in a Pipeline</p>
1181+
</div>
1182+
<table>
1183+
<thead>
1184+
<tr>
1185+
<th>Field</th>
1186+
<th>Description</th>
1187+
</tr>
1188+
</thead>
1189+
<tbody>
1190+
<tr>
1191+
<td>
1192+
<code>params</code><br/>
1193+
<em>
1194+
<a href="#tekton.dev/v1.Param">
1195+
[]Param
1196+
</a>
1197+
</em>
1198+
</td>
1199+
<td>
1200+
<p>Params is a list of parameters used to fan out the pipelineTask
1201+
Params takes only <code>Parameters</code> of type <code>&quot;array&quot;</code>
1202+
Each array element is supplied to the <code>PipelineTask</code> by substituting <code>params</code> of type <code>&quot;string&quot;</code> in the underlying <code>Task</code>.
1203+
The names of the <code>params</code> in the <code>Matrix</code> must match the names of the <code>params</code> in the underlying <code>Task</code> that they will be substituting.</p>
1204+
</td>
1205+
</tr>
1206+
</tbody>
1207+
</table>
11741208
<h3 id="tekton.dev/v1.OnErrorType">OnErrorType
11751209
(<code>string</code> alias)</h3>
11761210
<p>
@@ -1197,7 +1231,7 @@ TaskSpec
11971231
<h3 id="tekton.dev/v1.Param">Param
11981232
</h3>
11991233
<p>
1200-
(<em>Appears on:</em><a href="#tekton.dev/v1.PipelineRunSpec">PipelineRunSpec</a>, <a href="#tekton.dev/v1.PipelineTask">PipelineTask</a>, <a href="#tekton.dev/v1.ResolverRef">ResolverRef</a>, <a href="#tekton.dev/v1.TaskRunInputs">TaskRunInputs</a>, <a href="#tekton.dev/v1.TaskRunSpec">TaskRunSpec</a>)
1234+
(<em>Appears on:</em><a href="#tekton.dev/v1.Matrix">Matrix</a>, <a href="#tekton.dev/v1.PipelineRunSpec">PipelineRunSpec</a>, <a href="#tekton.dev/v1.PipelineTask">PipelineTask</a>, <a href="#tekton.dev/v1.ResolverRef">ResolverRef</a>, <a href="#tekton.dev/v1.TaskRunInputs">TaskRunInputs</a>, <a href="#tekton.dev/v1.TaskRunSpec">TaskRunSpec</a>)
12011235
</p>
12021236
<div>
12031237
<p>Param declares an ParamValues to use for the parameter called name.</p>
@@ -2268,8 +2302,8 @@ this Task executes. (Used to force a specific ordering in graph execution.)</p>
22682302
<td>
22692303
<code>matrix</code><br/>
22702304
<em>
2271-
<a href="#tekton.dev/v1.Param">
2272-
[]Param
2305+
<a href="#tekton.dev/v1.Matrix">
2306+
Matrix
22732307
</a>
22742308
</em>
22752309
</td>
@@ -8126,6 +8160,40 @@ TaskSpec
81268160
</tr>
81278161
</tbody>
81288162
</table>
8163+
<h3 id="tekton.dev/v1beta1.Matrix">Matrix
8164+
</h3>
8165+
<p>
8166+
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.PipelineTask">PipelineTask</a>)
8167+
</p>
8168+
<div>
8169+
<p>Matrix is used to fan out Tasks in a Pipeline</p>
8170+
</div>
8171+
<table>
8172+
<thead>
8173+
<tr>
8174+
<th>Field</th>
8175+
<th>Description</th>
8176+
</tr>
8177+
</thead>
8178+
<tbody>
8179+
<tr>
8180+
<td>
8181+
<code>params</code><br/>
8182+
<em>
8183+
<a href="#tekton.dev/v1beta1.Param">
8184+
[]Param
8185+
</a>
8186+
</em>
8187+
</td>
8188+
<td>
8189+
<p>Params is a list of parameters used to fan out the pipelineTask
8190+
Params takes only <code>Parameters</code> of type <code>&quot;array&quot;</code>
8191+
Each array element is supplied to the <code>PipelineTask</code> by substituting <code>params</code> of type <code>&quot;string&quot;</code> in the underlying <code>Task</code>.
8192+
The names of the <code>params</code> in the <code>Matrix</code> must match the names of the <code>params</code> in the underlying <code>Task</code> that they will be substituting.</p>
8193+
</td>
8194+
</tr>
8195+
</tbody>
8196+
</table>
81298197
<h3 id="tekton.dev/v1beta1.OnErrorType">OnErrorType
81308198
(<code>string</code> alias)</h3>
81318199
<p>
@@ -8137,7 +8205,7 @@ TaskSpec
81378205
<h3 id="tekton.dev/v1beta1.Param">Param
81388206
</h3>
81398207
<p>
8140-
(<em>Appears on:</em><a href="#tekton.dev/v1alpha1.RunSpec">RunSpec</a>, <a href="#tekton.dev/v1beta1.CustomRunSpec">CustomRunSpec</a>, <a href="#tekton.dev/v1beta1.PipelineRunSpec">PipelineRunSpec</a>, <a href="#tekton.dev/v1beta1.PipelineTask">PipelineTask</a>, <a href="#tekton.dev/v1beta1.ResolverRef">ResolverRef</a>, <a href="#tekton.dev/v1beta1.TaskRunInputs">TaskRunInputs</a>, <a href="#tekton.dev/v1beta1.TaskRunSpec">TaskRunSpec</a>)
8208+
(<em>Appears on:</em><a href="#tekton.dev/v1alpha1.RunSpec">RunSpec</a>, <a href="#tekton.dev/v1beta1.CustomRunSpec">CustomRunSpec</a>, <a href="#tekton.dev/v1beta1.Matrix">Matrix</a>, <a href="#tekton.dev/v1beta1.PipelineRunSpec">PipelineRunSpec</a>, <a href="#tekton.dev/v1beta1.PipelineTask">PipelineTask</a>, <a href="#tekton.dev/v1beta1.ResolverRef">ResolverRef</a>, <a href="#tekton.dev/v1beta1.TaskRunInputs">TaskRunInputs</a>, <a href="#tekton.dev/v1beta1.TaskRunSpec">TaskRunSpec</a>)
81418209
</p>
81428210
<div>
81438211
<p>Param declares an ParamValues to use for the parameter called name.</p>
@@ -9483,8 +9551,8 @@ outputs.</p>
94839551
<td>
94849552
<code>matrix</code><br/>
94859553
<em>
9486-
<a href="#tekton.dev/v1beta1.Param">
9487-
[]Param
9554+
<a href="#tekton.dev/v1beta1.Matrix">
9555+
Matrix
94889556
</a>
94899557
</em>
94909558
</td>

examples/v1beta1/pipelineruns/alpha/pipelinerun-with-matrix-and-results.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ spec:
5151
printf firefox | tee /tekton/results/three
5252
- name: platforms-and-browsers-dag
5353
matrix:
54-
- name: platform
55-
value:
56-
- $(tasks.get-platforms.results.one)
57-
- $(tasks.get-platforms.results.two)
58-
- $(tasks.get-platforms.results.three)
59-
- name: browser
60-
value:
61-
- $(tasks.get-browsers.results.one)
62-
- $(tasks.get-browsers.results.two)
54+
params:
55+
- name: platform
56+
value:
57+
- $(tasks.get-platforms.results.one)
58+
- $(tasks.get-platforms.results.two)
59+
- $(tasks.get-platforms.results.three)
60+
- name: browser
61+
value:
62+
- $(tasks.get-browsers.results.one)
63+
- $(tasks.get-browsers.results.two)
6364
taskRef:
6465
name: platform-browsers

0 commit comments

Comments
 (0)