forked from tektoncd/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray-default.yaml
63 lines (63 loc) · 1.82 KB
/
array-default.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: array-with-default-
spec:
params:
- name: array-to-echo
value:
- "foo"
- "bar"
taskSpec:
params:
- name: array-to-echo
type: array
- name: another-array-to-echo
type: array
default:
- "foo-default"
- "bar-default"
- name: string-to-echo
type: string
default: "baz"
steps:
# this step should echo "foo bar foo-default bar-default baz"
- name: echo-params
image: bash:3.2
args: [
"$(params.array-to-echo[*])",
"$(params.another-array-to-echo[*])",
"$(params.string-to-echo)",
]
script: |
#!/usr/bin/env bash
if [[ $# != 5 ]]; then
echo "failed to validate the length of the arguments"
echo "Want: 5, Got: $#"
exit 1
fi
if [[ $1 != "foo" ]]; then
echo "failed to validate the first argument to the script"
echo "Want: foo, Got: $1"
exit 1
fi
if [[ $2 != "bar" ]]; then
echo "failed to validate the second argument to the script"
echo "Want: bar, Got: $2"
exit 1
fi
if [[ $3 != "foo-default" ]]; then
echo "failed to validate the third argument to the script"
echo "Want: foo-default, Got: $3"
exit 1
fi
if [[ $4 != "bar-default" ]]; then
echo "failed to validate the fourth argument to the script"
echo "Want: bar-default, Got: $4"
exit 1
fi
if [[ $5 != "baz" ]]; then
echo "failed to validate the fifth argument to the script"
echo "Want: baz, Got: $5"
exit 1
fi