Protect if {volumes} or env is None
[releng.git] / jjb / functest / xtesting-pi.yaml
1 ---
2 - xtesting-pi-containers: &xtesting-pi-containers
3     name: 'xtesting-pi-containers'
4     repo: '{repo}'
5     port: '{port}'
6     container: '{container}'
7     tag: '{tag}'
8
9 - xtesting-pi-params: &xtesting-pi-params
10     name: 'xtesting-pi-params'
11     repo: 'ollivier'
12     port:
13     tag:
14       - latest:
15           slave: lf-virtual1
16       - wallaby:
17           slave: lf-virtual1
18       - leguer:
19           slave: lf-virtual1
20       - kali:
21           slave: lf-virtual1
22       - jerma:
23           slave: lf-virtual1
24       - arm-latest:
25           slave: lf-virtual1
26       - arm-wallaby:
27           slave: lf-virtual1
28       - arm-leguer:
29           slave: lf-virtual1
30       - arm-kali:
31           slave: lf-virtual1
32       - arm-jerma:
33           slave: lf-virtual1
34       - arm64-latest:
35           slave: lf-virtual1
36       - arm64-wallaby:
37           slave: lf-virtual1
38       - arm64-leguer:
39           slave: lf-virtual1
40       - arm64-kali:
41           slave: lf-virtual1
42       - arm64-jerma:
43           slave: lf-virtual1
44
45 - xtesting-pi-jobs: &xtesting-pi-jobs
46     name: 'xtesting-pi-jobs'
47     current-parameters: true
48
49 - parameter:
50     name: xtesting-pi-slave
51     parameters:
52       - label:
53           name: slave
54           default: '{slave}'
55
56 - parameter:
57     name: xtesting-pi-build_tag
58     parameters:
59       - random-string:
60           name: build_tag
61
62 - xtesting-pi-run-containers: &xtesting-pi-run-containers
63     name: 'xtesting-pi-run-containers'
64     <<: *xtesting-pi-containers
65     test: '{test}'
66     privileged: '{privileged}'
67     volumes: '{volumes}'
68     env: '{env}'
69     network: '{network}'
70
71 - builder:
72     name: xtesting-pi-pull-containers
73     builders:
74       - shell: |
75           set +x
76           if [ "{repo}" = "_" ]; then
77             image={container}:{tag}
78           elif [ "{port}" = "None" ]; then
79             image={repo}/{container}:{tag}
80           else
81             image={repo}:{port}/{container}:{tag}
82           fi
83           docker pull $image
84
85 - builder:
86     name: xtesting-pi-run-containers
87     builders:
88       - shell: |
89           set +x
90           volumes=;
91           if [ "{volumes}" != "None" ]; then
92             for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done
93           fi
94           env=;
95           if [ "{env}" != "None" ]; then
96             for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done
97           fi
98           [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true
99           if [ "{repo}" = "_" ]; then
100             image={container}:{tag}
101           elif [ "{port}" = "None" ]; then
102             image={repo}/{container}:{tag}
103           else
104             image={repo}:{port}/{container}:{tag}
105           fi
106           docker run --rm \
107             --privileged={privileged} \
108             --network={network} \
109             $volumes \
110             $env \
111             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
112             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
113             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting/$BUILD_TAG/$JOB_NAME-$BUILD_ID \
114             -v /home/opnfv/xtesting/.boto:/root/.boto \
115             -e TEST_DB_URL=http://testresults.opnfv.org/test/api/v1/results \
116             -e TEST_DB_EXT_URL=http://testresults.opnfv.org/test/api/v1/results \
117             -e NODE_NAME=$slave \
118             -e BUILD_TAG=$BUILD_TAG \
119             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
120             $image run_tests -t {test} -p -r
121
122 - builder:
123     name: xtesting-pi-remove-images
124     builders:
125       - shell: |
126           set +x
127           if [ "{repo}" = "_" ]; then
128             image={container}:{tag}
129           elif [ "{port}" = "None" ]; then
130             image={repo}/{container}:{tag}
131           else
132             image={repo}:{port}/{container}:{tag}
133           fi
134           docker rmi $image || true
135
136 - job-template:
137     name: 'xtesting-pi-{repo}-{container}-{tag}-pull'
138     parameters:
139       - xtesting-pi-slave:
140           slave: '{slave}'
141     builders:
142       - xtesting-pi-pull-containers:
143           <<: *xtesting-pi-containers
144
145 - project:
146     name: 'xtesting-pi-ollivier-xtesting-pull'
147     <<: *xtesting-pi-params
148     container: 'xtesting'
149     jobs:
150       - 'xtesting-pi-{repo}-{container}-{tag}-pull'
151
152 - project:
153     name: 'xtesting-pi-ollivier-xtesting-mts-pull'
154     <<: *xtesting-pi-params
155     container: 'xtesting-mts'
156     jobs:
157       - 'xtesting-pi-{repo}-{container}-{tag}-pull'
158
159 - job-template:
160     name: 'xtesting-pi-{repo}-{container}-{tag}-rmi'
161     parameters:
162       - xtesting-pi-slave:
163           slave: '{slave}'
164     builders:
165       - xtesting-pi-remove-images:
166           <<: *xtesting-pi-containers
167
168 - project:
169     name: 'xtesting-pi-ollivier-xtesting-rmi'
170     <<: *xtesting-pi-params
171     container: 'xtesting'
172     jobs:
173       - 'xtesting-pi-{repo}-{container}-{tag}-rmi'
174
175 - project:
176     name: 'xtesting-pi-ollivier-xtesting-mts-rmi'
177     <<: *xtesting-pi-params
178     container: 'xtesting-mts'
179     jobs:
180       - 'xtesting-pi-{repo}-{container}-{tag}-rmi'
181
182 - job-template:
183     name: 'xtesting-pi-ollivier-xtesting-{tag}-{test}-run'
184     parameters:
185       - xtesting-pi-slave:
186           slave: '{slave}'
187       - xtesting-pi-build_tag:
188           build_tag: ''
189     builders:
190       - xtesting-pi-run-containers:
191           <<: *xtesting-pi-run-containers
192
193 - project:
194     name: 'xtesting-pi-ollivier-xtesting'
195     <<: *xtesting-pi-params
196     volumes:
197     env:
198     container: 'xtesting'
199     test:
200       - first
201       - second
202       - third
203       - fourth
204       - fifth
205       - sixth
206       - eighth
207     privileged: 'false'
208     network: bridge
209     exclude:
210       - tag: leguer
211         test: eighth
212       - tag: kali
213         test: eighth
214       - tag: jerma
215         test: eighth
216       - tag: arm-leguer
217         test: eighth
218       - tag: arm-kali
219         test: eighth
220       - tag: arm-jerma
221         test: eighth
222       - tag: arm64-leguer
223         test: eighth
224       - tag: arm64-kali
225         test: eighth
226       - tag: arm64-jerma
227         test: eighth
228     jobs:
229       - 'xtesting-pi-ollivier-xtesting-{tag}-{test}-run'
230
231 - job-template:
232     name: 'xtesting-pi-ollivier-xtesting-mts-{tag}-{test}-run'
233     parameters:
234       - xtesting-pi-slave:
235           slave: '{slave}'
236       - xtesting-pi-build_tag:
237           build_tag: ''
238     builders:
239       - xtesting-pi-run-containers:
240           <<: *xtesting-pi-run-containers
241
242 - project:
243     name: 'xtesting-pi-ollivier-xtesting-mts'
244     <<: *xtesting-pi-params
245     volumes:
246     env:
247     container: 'xtesting-mts'
248     test:
249       - seventh
250     privileged: 'false'
251     network: bridge
252     jobs:
253       - 'xtesting-pi-ollivier-xtesting-mts-{tag}-{test}-run'
254
255 - builder:
256     name: xtesting-pi-zip
257     builders:
258       - shell: |
259           set +x
260           volumes=; for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done
261           env=; for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done
262           [ ! -z "$WORKSPACE" ] && rm -rf $WORKSPACE/results || true
263           if [ "{repo}" = "_" ]; then
264             image={container}:{tag}
265           elif [ "{port}" = "None" ]; then
266             image={repo}/{container}:{tag}
267           else
268             image={repo}:{port}/{container}:{tag}
269           fi
270           docker run --rm \
271             $volumes \
272             $env \
273             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
274             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting \
275             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting \
276             -v /home/opnfv/xtesting/.boto:/root/.boto \
277             -e TEST_DB_URL=http://testresults.opnfv.org/test/api/v1/results \
278             -e TEST_DB_EXT_URL=http://testresults.opnfv.org/test/api/v1/results \
279             -e BUILD_TAG=$BUILD_TAG \
280             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
281             $image zip_campaign
282
283 - job-template:
284     name: 'xtesting-pi-{tag}-zip'
285     parameters:
286       - xtesting-pi-slave:
287           slave: '{slave}'
288       - xtesting-pi-build_tag:
289           build_tag: ''
290     builders:
291       - xtesting-pi-zip:
292           <<: *xtesting-pi-containers
293           volumes: '{volumes}'
294           env: '{env}'
295
296 - project:
297     name: 'xtesting-pi-{tag}-zip'
298     <<: *xtesting-pi-params
299     volumes:
300     env:
301     container: 'xtesting'
302     jobs:
303       - 'xtesting-pi-{tag}-zip'
304
305 - job-template:
306     name: 'xtesting-pi-{tag}-daily'
307     project-type: multijob
308     triggers:
309       - timed: '@daily'
310     parameters:
311       - xtesting-pi-slave:
312           slave: '{slave}'
313       - xtesting-pi-build_tag:
314           build_tag: ''
315     # PyYAML and yamllint differ here
316     # see https://github.com/yaml/pyyaml/issues/234
317     # yamllint disable rule:indentation
318     properties:
319       - build-blocker:
320           blocking-jobs:
321           - ^xtesting-(pi-)*{tag}-(daily|docker|review)$
322     # yamllint enable rule:indentation
323     builders:
324       - multijob:
325           name: remove former images
326           projects:
327             - name: 'xtesting-pi-ollivier-xtesting-{tag}-rmi'
328               <<: *xtesting-pi-jobs
329             - name: 'xtesting-pi-ollivier-xtesting-mts-{tag}-rmi'
330               <<: *xtesting-pi-jobs
331       - multijob:
332           name: pull containers
333           projects:
334             - name: 'xtesting-pi-ollivier-xtesting-{tag}-pull'
335               <<: *xtesting-pi-jobs
336             - name: 'xtesting-pi-ollivier-xtesting-mts-{tag}-pull'
337               <<: *xtesting-pi-jobs
338       - multijob:
339           name: ollivier/xtesting:{tag}
340           projects:
341             - name: 'xtesting-pi-ollivier-xtesting-{tag}-first-run'
342               <<: *xtesting-pi-jobs
343             - name: 'xtesting-pi-ollivier-xtesting-{tag}-second-run'
344               <<: *xtesting-pi-jobs
345             - name: 'xtesting-pi-ollivier-xtesting-{tag}-third-run'
346               <<: *xtesting-pi-jobs
347             - name: 'xtesting-pi-ollivier-xtesting-{tag}-fourth-run'
348               <<: *xtesting-pi-jobs
349             - name: 'xtesting-pi-ollivier-xtesting-{tag}-fifth-run'
350               <<: *xtesting-pi-jobs
351             - name: 'xtesting-pi-ollivier-xtesting-{tag}-sixth-run'
352               <<: *xtesting-pi-jobs
353             - name: 'xtesting-pi-ollivier-xtesting-{tag}-eighth-run'
354               <<: *xtesting-pi-jobs
355       - multijob:
356           name: ollivier/xtesting-mts:{tag}
357           projects:
358             - name: 'xtesting-pi-ollivier-xtesting-mts-{tag}-seventh-run'
359               <<: *xtesting-pi-jobs
360       - multijob:
361           name: dump all campaign data
362           projects:
363             - name: 'xtesting-pi-{tag}-zip'
364               <<: *xtesting-pi-jobs
365
366 - project:
367     name: 'xtesting-pi-daily'
368     <<: *xtesting-pi-params
369     jobs:
370       - 'xtesting-pi-{tag}-daily'
371
372 - view:
373     name: xtesting-pi
374     view-type: list
375     columns:
376       - status
377       - weather
378       - job
379       - last-success
380       - last-failure
381       - last-duration
382     regex: ^xtesting-pi-[a-z-0-9.]+-daily$