7
7
- name : result1
8
8
- name : result2
9
9
- name : result3
10
+ type : array
11
+ description : The Array results
10
12
- name : result4
11
13
- name : result5
14
+ type : object
15
+ description : The object results
16
+ properties :
17
+ url :
18
+ type : string
19
+ digest :
20
+ type : string
12
21
steps :
13
22
- name : step1
14
23
image : alpine
15
24
script : |
16
- cat /dev/urandom | head -c 2500 | base64 | tee $(results.result1.path);
17
- cat /dev/urandom | head -c 2500 | base64 | tee $(results.result2.path);
18
- cat /dev/urandom | head -c 2500 | base64 | tee $(results.result3.path);
19
- cat /dev/urandom | head -c 2500 | base64 | tee $(results.result4.path);
20
- cat /dev/urandom | head -c 2500 | base64 | tee $(results.result5.path);
25
+ # produce a result - a random string with 2,500 characters - result1
26
+ tr -dc A-Za-z0-9 </dev/urandom | head -c 2500 | tee $(results.result1.path);
27
+
28
+ # produce a result - a random string with 2,500 characters - result2
29
+ tr -dc A-Za-z0-9 </dev/urandom | head -c 2500 | tee $(results.result2.path);
30
+
31
+ # produce a result - an array with four elements - result3
32
+ URL1=`tr -dc A-Za-z0-9 </dev/urandom | head -c 600`
33
+ URL2=`tr -dc A-Za-z0-9 </dev/urandom | head -c 700`
34
+ URL3=`tr -dc A-Za-z0-9 </dev/urandom | head -c 800`
35
+ echo -n "[\"$URL1\", \"\", \"$URL2\", \"$URL3\"]" | tee $(results.result3.path)
36
+
37
+ # produce a result - a random string with 2,500 characters - result4
38
+ tr -dc A-Za-z0-9 </dev/urandom | head -c 2500 | tee $(results.result4.path);
39
+
40
+ # produce a result - a hash with two objects - result5
41
+ URL=`tr -dc A-Za-z0-9 </dev/urandom | head -c 2000`
42
+ DIGEST=`tr -dc A-Za-z0-9 </dev/urandom | head -c 200`
43
+ echo -n "{\"url\":\"$URL\",\"digest\":\"$DIGEST\"}" | tee $(results.result5.path)
21
44
---
45
+
22
46
apiVersion : tekton.dev/v1
23
47
kind : Task
24
48
metadata :
25
- name : print -large-results
49
+ name : verify -large-results
26
50
spec :
27
51
params :
28
52
- name : param1
29
53
- name : param2
30
54
- name : param3
55
+ description : The array param
56
+ type : array
31
57
- name : param4
32
58
- name : param5
59
+ description : The object param
60
+ properties :
61
+ url :
62
+ type : string
63
+ digest :
64
+ type : string
33
65
steps :
34
66
- name : step1
35
67
image : alpine
68
+ args : [
69
+ " $(params.param3[*])"
70
+ ]
36
71
script : |
37
- echo "$(params.param1)";
38
- echo "$(params.param2)";
39
- echo "$(params.param3)";
40
- echo "$(params.param4)";
41
- echo "$(params.param5)";
72
+ #!/usr/bin/env sh
73
+ echo "Validating the length of the param reading larger result - param1"
74
+ echo "The string param, param1 must be 2500 characters long"
75
+ p1=$(params.param1)
76
+ if [ "${#p1}" != 2500 ]; then
77
+ echo "Error: expected 2500 characters in param1 but has ${#p1} characters"
78
+ exit 1
79
+ fi
80
+ echo "Done validating the length of the param reading larger result - param1"
81
+
82
+ echo "Validating the length of the param reading larger result - param2"
83
+ echo "The string param, param2 must be 2500 characters long"
84
+ p2=$(params.param2)
85
+ if [ "${#p2}" != 2500 ]; then
86
+ echo "Error: expected 2500 characters in param2 but has ${#p2} characters"
87
+ exit 1
88
+ fi
89
+ echo "Done validating the length of the param reading larger result - param2"
90
+
91
+ echo "Validating the length of the array parameter - param3"
92
+ echo "The array parameter, param3 must have 4 elements"
93
+ if [[ $# != 4 ]]; then
94
+ echo "Error: expected 4 elements in param3 but has $# characters"
95
+ exit 1
96
+ fi
97
+ echo "Done validating the length of the array parameter - param3"
98
+
99
+ echo "Validating the first element"
100
+ if [ "${#1}" != 600 ]; then
101
+ echo "Error: expected 600 characters in the first array element but has ${#1} characters"
102
+ exit 1
103
+ fi
104
+ echo "Done validating the first element"
105
+
106
+ echo "Validating the second element"
107
+ if [ "${#2}" != 0 ]; then
108
+ echo "Error: expected 0 characters in the second array element but has ${#2} characters"
109
+ exit 1
110
+ fi
111
+ echo "Done validating the second element"
112
+
113
+ echo "Validating the third element"
114
+ if [ "${#3}" != 700 ]; then
115
+ echo "Error: expected 700 characters in the third array element but has ${#3} characters"
116
+ exit 1
117
+ fi
118
+ echo "Done validating the third element"
119
+
120
+ echo "Validating the fourth element"
121
+ if [ "${#4}" != 800 ]; then
122
+ echo "Error: expected 800 characters in the fourth array element but has ${#4} characters"
123
+ exit 1
124
+ fi
125
+ echo "Done validating the fourth element"
126
+
127
+ echo "Validating the length of the param reading larger result - param4"
128
+ echo "The string param, param4 must be 2500 characters long"
129
+ p4=$(params.param4)
130
+ if [ "${#p4}" != 2500 ]; then
131
+ echo "Error: expected 2500 characters in param4 but has ${#p4} characters"
132
+ exit 1
133
+ fi
134
+ echo "Done validating the length of the param reading larger result - param4"
135
+
136
+ echo "validating param5.url"
137
+ p51=$(params.param5.url)
138
+ if [ "${#p51}" != 2000 ]; then
139
+ echo "Error: expected 2000 characters in the url of the hash param \"param5\" but has ${#p51} characters"
140
+ exit 1
141
+ fi
142
+ echo "Done validating param5.url"
143
+
144
+ echo "Validating param5.digest"
145
+ p52=$(params.param5.digest)
146
+ if [ "${#p52}" != 200 ]; then
147
+ echo "Error: expected 200 characters in the digest of the hash param \"param5\" but has ${#p52} characters"
148
+ exit 1
149
+ fi
150
+ echo "Done validating param5.digest"
42
151
---
152
+
43
153
apiVersion : tekton.dev/v1
44
154
kind : Pipeline
45
155
metadata :
@@ -49,28 +159,28 @@ spec:
49
159
- name : large-task
50
160
taskRef :
51
161
name : large-result-task
52
- - name : print -results
162
+ - name : verify -results
53
163
params :
54
164
- name : param1
55
165
value : " $(tasks.large-task.results.result1)"
56
166
- name : param2
57
167
value : " $(tasks.large-task.results.result2)"
58
168
- name : param3
59
- value : " $(tasks.large-task.results.result3)"
169
+ value : " $(tasks.large-task.results.result3[*] )"
60
170
- name : param4
61
171
value : " $(tasks.large-task.results.result4)"
62
172
- name : param5
63
- value : " $(tasks.large-task.results.result5)"
173
+ value : " $(tasks.large-task.results.result5[*] )"
64
174
taskRef :
65
- name : print -large-results
175
+ name : verify -large-results
66
176
results :
67
177
- name : large-result
68
178
value : $(tasks.large-task.results.result1)
69
179
---
70
180
apiVersion : tekton.dev/v1
71
181
kind : PipelineRun
72
182
metadata :
73
- name : large-result-pipeline-run
183
+ generateName : large-result-pipeline-run
74
184
spec :
75
185
pipelineRef :
76
186
name : large-result-pipeline
0 commit comments