@@ -29,6 +29,7 @@ import (
29
29
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
30
30
"github.com/tektoncd/pipeline/test/diff"
31
31
"github.com/tektoncd/pipeline/test/parse"
32
+ corev1 "k8s.io/api/core/v1"
32
33
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
33
34
"knative.dev/pkg/apis"
34
35
duckv1 "knative.dev/pkg/apis/duck/v1"
@@ -68,11 +69,14 @@ spec:
68
69
default: ""
69
70
- name: package
70
71
default: ""
72
+ results:
73
+ - name: str
74
+ type: string
71
75
steps:
72
76
- name: echo
73
77
image: mirror.gcr.io/alpine
74
78
script: |
75
- echo "$(params.GOARCH) and $(params.version)"
79
+ echo -n "$(params.GOARCH) and $(params.version)" | tee $(results.str.path)
76
80
` , namespace ))
77
81
78
82
task1withresults := parse .MustParseV1Task (t , fmt .Sprintf (`
@@ -107,6 +111,22 @@ spec:
107
111
echo -n "[\"go1.17\",\"go1.18.1\"]" | tee $(results.versions.path)
108
112
` , namespace ))
109
113
114
+ task3printer := parse .MustParseV1Task (t , fmt .Sprintf (`
115
+ metadata:
116
+ name: printer
117
+ namespace: %s
118
+ spec:
119
+ params:
120
+ - name: platform
121
+ value: "default-platform"
122
+ steps:
123
+ - name: produce-a-list-of-versions
124
+ image: mirror.gcr.io/bash
125
+ script: |
126
+ #!/usr/bin/env bash
127
+ echo "platform: $(params.platform)"
128
+ ` , namespace ))
129
+
110
130
if _ , err := c .V1TaskClient .Create (ctx , task , metav1.CreateOptions {}); err != nil {
111
131
t .Fatalf ("Failed to create Task `%s`: %s" , task .Name , err )
112
132
}
@@ -116,6 +136,9 @@ spec:
116
136
if _ , err := c .V1TaskClient .Create (ctx , task2withresults , metav1.CreateOptions {}); err != nil {
117
137
t .Fatalf ("Failed to create Task `%s`: %s" , task2withresults .Name , err )
118
138
}
139
+ if _ , err := c .V1TaskClient .Create (ctx , task3printer , metav1.CreateOptions {}); err != nil {
140
+ t .Fatalf ("Failed to create Task `%s`: %s" , task3printer .Name , err )
141
+ }
119
142
120
143
pipeline := parse .MustParseV1Pipeline (t , fmt .Sprintf (`
121
144
metadata:
@@ -157,6 +180,13 @@ spec:
157
180
params:
158
181
- name: GOARCH
159
182
value: I-do-not-exist
183
+ - name: printer-matrix
184
+ taskRef:
185
+ name: printer
186
+ matrix:
187
+ params:
188
+ - name: platform
189
+ value: $(tasks.matrix-include.results.str[*])
160
190
` , helpers .ObjectNameForTest (t ), namespace ))
161
191
162
192
pipelineRun := parse .MustParseV1PipelineRun (t , fmt .Sprintf (`
@@ -208,6 +238,11 @@ spec:
208
238
}}},
209
239
TaskRunStatusFields : v1.TaskRunStatusFields {
210
240
Artifacts : & v1.Artifacts {},
241
+ Results : []v1.TaskRunResult {{
242
+ Name : "str" ,
243
+ Type : v1 .ResultsTypeString ,
244
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/amd64 and go1.17" },
245
+ }},
211
246
},
212
247
},
213
248
}, {
@@ -240,6 +275,11 @@ spec:
240
275
}}},
241
276
TaskRunStatusFields : v1.TaskRunStatusFields {
242
277
Artifacts : & v1.Artifacts {},
278
+ Results : []v1.TaskRunResult {{
279
+ Name : "str" ,
280
+ Type : v1 .ResultsTypeString ,
281
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/ppc64le and go1.17" },
282
+ }},
243
283
},
244
284
},
245
285
}, {
@@ -269,6 +309,11 @@ spec:
269
309
}}},
270
310
TaskRunStatusFields : v1.TaskRunStatusFields {
271
311
Artifacts : & v1.Artifacts {},
312
+ Results : []v1.TaskRunResult {{
313
+ Name : "str" ,
314
+ Type : v1 .ResultsTypeString ,
315
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/amd64 and go1.18.1" },
316
+ }},
272
317
},
273
318
},
274
319
}, {
@@ -298,6 +343,11 @@ spec:
298
343
}}},
299
344
TaskRunStatusFields : v1.TaskRunStatusFields {
300
345
Artifacts : & v1.Artifacts {},
346
+ Results : []v1.TaskRunResult {{
347
+ Name : "str" ,
348
+ Type : v1 .ResultsTypeString ,
349
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/ppc64le and go1.18.1" },
350
+ }},
301
351
},
302
352
},
303
353
}, {
@@ -319,6 +369,136 @@ spec:
319
369
Reason : "Succeeded" ,
320
370
Message : "All Steps have completed executing" ,
321
371
}}},
372
+ TaskRunStatusFields : v1.TaskRunStatusFields {
373
+ Artifacts : & v1.Artifacts {},
374
+ Results : []v1.TaskRunResult {{
375
+ Name : "str" ,
376
+ Type : v1 .ResultsTypeString ,
377
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "I-do-not-exist and " },
378
+ }},
379
+ },
380
+ },
381
+ }, {
382
+ ObjectMeta : metav1.ObjectMeta {
383
+ Name : "pr-printer-matrix-0" ,
384
+ },
385
+ Spec : v1.TaskRunSpec {
386
+ Params : v1.Params {{
387
+ Name : "platform" ,
388
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/amd64 and go1.17" },
389
+ }},
390
+ ServiceAccountName : "default" ,
391
+ TaskRef : & v1.TaskRef {Name : "printer" , Kind : v1 .NamespacedTaskKind },
392
+ },
393
+ Status : v1.TaskRunStatus {
394
+ Status : duckv1.Status {
395
+ Conditions : duckv1.Conditions {{
396
+ Type : apis .ConditionSucceeded ,
397
+ Status : corev1 .ConditionTrue ,
398
+ Reason : "Succeeded" ,
399
+ Message : "All Steps have completed executing" ,
400
+ }},
401
+ },
402
+ TaskRunStatusFields : v1.TaskRunStatusFields {
403
+ Artifacts : & v1.Artifacts {},
404
+ },
405
+ },
406
+ }, {
407
+ ObjectMeta : metav1.ObjectMeta {
408
+ Name : "pr-printer-matrix-1" ,
409
+ },
410
+ Spec : v1.TaskRunSpec {
411
+ Params : v1.Params {{
412
+ Name : "platform" ,
413
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/ppc64le and go1.17" },
414
+ }},
415
+ ServiceAccountName : "default" ,
416
+ TaskRef : & v1.TaskRef {Name : "printer" , Kind : v1 .NamespacedTaskKind },
417
+ },
418
+ Status : v1.TaskRunStatus {
419
+ Status : duckv1.Status {
420
+ Conditions : duckv1.Conditions {{
421
+ Type : apis .ConditionSucceeded ,
422
+ Status : corev1 .ConditionTrue ,
423
+ Reason : "Succeeded" ,
424
+ Message : "All Steps have completed executing" ,
425
+ }},
426
+ },
427
+ TaskRunStatusFields : v1.TaskRunStatusFields {
428
+ Artifacts : & v1.Artifacts {},
429
+ },
430
+ },
431
+ }, {
432
+ ObjectMeta : metav1.ObjectMeta {
433
+ Name : "pr-printer-matrix-2" ,
434
+ },
435
+ Spec : v1.TaskRunSpec {
436
+ Params : v1.Params {{
437
+ Name : "platform" ,
438
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/amd64 and go1.18.1" },
439
+ }},
440
+ ServiceAccountName : "default" ,
441
+ TaskRef : & v1.TaskRef {Name : "printer" , Kind : v1 .NamespacedTaskKind },
442
+ },
443
+ Status : v1.TaskRunStatus {
444
+ Status : duckv1.Status {
445
+ Conditions : duckv1.Conditions {{
446
+ Type : apis .ConditionSucceeded ,
447
+ Status : corev1 .ConditionTrue ,
448
+ Reason : "Succeeded" ,
449
+ Message : "All Steps have completed executing" ,
450
+ }},
451
+ },
452
+ TaskRunStatusFields : v1.TaskRunStatusFields {
453
+ Artifacts : & v1.Artifacts {},
454
+ },
455
+ },
456
+ }, {
457
+ ObjectMeta : metav1.ObjectMeta {
458
+ Name : "pr-printer-matrix-3" ,
459
+ },
460
+ Spec : v1.TaskRunSpec {
461
+ Params : v1.Params {{
462
+ Name : "platform" ,
463
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "linux/ppc64le and go1.18.1" },
464
+ }},
465
+ ServiceAccountName : "default" ,
466
+ TaskRef : & v1.TaskRef {Name : "printer" , Kind : v1 .NamespacedTaskKind },
467
+ },
468
+ Status : v1.TaskRunStatus {
469
+ Status : duckv1.Status {
470
+ Conditions : duckv1.Conditions {{
471
+ Type : apis .ConditionSucceeded ,
472
+ Status : corev1 .ConditionTrue ,
473
+ Reason : "Succeeded" ,
474
+ Message : "All Steps have completed executing" ,
475
+ }},
476
+ },
477
+ TaskRunStatusFields : v1.TaskRunStatusFields {
478
+ Artifacts : & v1.Artifacts {},
479
+ },
480
+ },
481
+ }, {
482
+ ObjectMeta : metav1.ObjectMeta {
483
+ Name : "pr-printer-matrix-4" ,
484
+ },
485
+ Spec : v1.TaskRunSpec {
486
+ Params : v1.Params {{
487
+ Name : "platform" ,
488
+ Value : v1.ParamValue {Type : v1 .ParamTypeString , StringVal : "I-do-not-exist and " },
489
+ }},
490
+ ServiceAccountName : "default" ,
491
+ TaskRef : & v1.TaskRef {Name : "printer" , Kind : v1 .NamespacedTaskKind },
492
+ },
493
+ Status : v1.TaskRunStatus {
494
+ Status : duckv1.Status {
495
+ Conditions : duckv1.Conditions {{
496
+ Type : apis .ConditionSucceeded ,
497
+ Status : corev1 .ConditionTrue ,
498
+ Reason : "Succeeded" ,
499
+ Message : "All Steps have completed executing" ,
500
+ }},
501
+ },
322
502
TaskRunStatusFields : v1.TaskRunStatusFields {
323
503
Artifacts : & v1.Artifacts {},
324
504
},
0 commit comments