Ask for sudo (from docker to shell)
[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           sudo 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" ] && sudo 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           sudo 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           sudo 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=;
261           if [ "{volumes}" != "None" ]; then
262             for i in $(echo {volumes} | tr -d '[] ' |sed "s/,/ /g" ); do volumes="-v $i $volumes"; done
263           fi
264           env=;
265           if [ "{env}" != "None" ]; then
266             for i in $(eval echo {env} | tr -d '[] ' |sed "s/,/ /g" ); do env="-e $i $env"; done
267           fi
268           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/results || true
269           if [ "{repo}" = "_" ]; then
270             image={container}:{tag}
271           elif [ "{port}" = "None" ]; then
272             image={repo}/{container}:{tag}
273           else
274             image={repo}:{port}/{container}:{tag}
275           fi
276           sudo docker run --rm \
277             $volumes \
278             $env \
279             -e S3_ENDPOINT_URL=https://storage.googleapis.com \
280             -e S3_DST_URL=s3://artifacts.opnfv.org/xtesting \
281             -e HTTP_DST_URL=http://artifacts.opnfv.org/xtesting \
282             -v /home/opnfv/xtesting/.boto:/root/.boto \
283             -e TEST_DB_URL=http://testresults.opnfv.org/test/api/v1/results \
284             -e TEST_DB_EXT_URL=http://testresults.opnfv.org/test/api/v1/results \
285             -e BUILD_TAG=$BUILD_TAG \
286             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
287             $image zip_campaign
288
289 - job-template:
290     name: 'xtesting-pi-{tag}-zip'
291     parameters:
292       - xtesting-pi-slave:
293           slave: '{slave}'
294       - xtesting-pi-build_tag:
295           build_tag: ''
296     builders:
297       - xtesting-pi-zip:
298           <<: *xtesting-pi-containers
299           volumes: '{volumes}'
300           env: '{env}'
301
302 - project:
303     name: 'xtesting-pi-{tag}-zip'
304     <<: *xtesting-pi-params
305     volumes:
306     env:
307     container: 'xtesting'
308     jobs:
309       - 'xtesting-pi-{tag}-zip'
310
311 - job-template:
312     name: 'xtesting-pi-{tag}-daily'
313     project-type: multijob
314     triggers:
315       - timed: '@daily'
316     parameters:
317       - xtesting-pi-slave:
318           slave: '{slave}'
319       - xtesting-pi-build_tag:
320           build_tag: ''
321     # PyYAML and yamllint differ here
322     # see https://github.com/yaml/pyyaml/issues/234
323     # yamllint disable rule:indentation
324     properties:
325       - build-blocker:
326           blocking-jobs:
327           - ^xtesting-(pi-)*{tag}-(daily|docker|review)$
328     # yamllint enable rule:indentation
329     builders:
330       - multijob:
331           name: remove former images
332           projects:
333             - name: 'xtesting-pi-ollivier-xtesting-{tag}-rmi'
334               <<: *xtesting-pi-jobs
335             - name: 'xtesting-pi-ollivier-xtesting-mts-{tag}-rmi'
336               <<: *xtesting-pi-jobs
337       - multijob:
338           name: pull containers
339           projects:
340             - name: 'xtesting-pi-ollivier-xtesting-{tag}-pull'
341               <<: *xtesting-pi-jobs
342             - name: 'xtesting-pi-ollivier-xtesting-mts-{tag}-pull'
343               <<: *xtesting-pi-jobs
344       - multijob:
345           name: ollivier/xtesting:{tag}
346           projects:
347             - name: 'xtesting-pi-ollivier-xtesting-{tag}-first-run'
348               <<: *xtesting-pi-jobs
349             - name: 'xtesting-pi-ollivier-xtesting-{tag}-second-run'
350               <<: *xtesting-pi-jobs
351             - name: 'xtesting-pi-ollivier-xtesting-{tag}-third-run'
352               <<: *xtesting-pi-jobs
353             - name: 'xtesting-pi-ollivier-xtesting-{tag}-fourth-run'
354               <<: *xtesting-pi-jobs
355             - name: 'xtesting-pi-ollivier-xtesting-{tag}-fifth-run'
356               <<: *xtesting-pi-jobs
357             - name: 'xtesting-pi-ollivier-xtesting-{tag}-sixth-run'
358               <<: *xtesting-pi-jobs
359             - name: 'xtesting-pi-ollivier-xtesting-{tag}-eighth-run'
360               <<: *xtesting-pi-jobs
361       - multijob:
362           name: ollivier/xtesting-mts:{tag}
363           projects:
364             - name: 'xtesting-pi-ollivier-xtesting-mts-{tag}-seventh-run'
365               <<: *xtesting-pi-jobs
366       - multijob:
367           name: dump all campaign data
368           projects:
369             - name: 'xtesting-pi-{tag}-zip'
370               <<: *xtesting-pi-jobs
371
372 - project:
373     name: 'xtesting-pi-daily'
374     <<: *xtesting-pi-params
375     jobs:
376       - 'xtesting-pi-{tag}-daily'
377
378 - view:
379     name: xtesting-pi
380     view-type: list
381     columns:
382       - status
383       - weather
384       - job
385       - last-success
386       - last-failure
387       - last-duration
388     regex: ^xtesting-pi-[a-z-0-9.]+-daily$