0c3d3bcf8509a3404db5d592e0f155a435a7ece2
[releng.git] / jjb / functest / xtesting.yaml
1 ---
2 - xtesting-jobs: &xtesting-jobs
3     name: 'xtesting-jobs'
4     current-parameters: true
5
6 - xtesting-params: &xtesting-params
7     name: 'xtesting-params'
8     repo: 'opnfv'
9     port:
10     tag:
11       - latest:
12           branch: master
13           slave: lf-build2
14       - iruya:
15           branch: stable/iruya
16           slave: lf-build2
17       - hunter:
18           branch: stable/hunter
19           slave: lf-build2
20
21 - parameter:
22     name: xtesting-slave
23     parameters:
24       - label:
25           name: slave
26           default: '{slave}'
27
28 - parameter:
29     name: xtesting-branch
30     parameters:
31       - string:
32           name: branch
33           default: '{branch}'
34
35 - xtesting-containers: &xtesting-containers
36     name: 'xtesting-containers'
37     repo: '{repo}'
38     port: '{port}'
39     container: '{container}'
40     tag: '{tag}'
41
42 - xtesting-run-containers: &xtesting-run-containers
43     name: 'xtesting-build-containers'
44     <<: *xtesting-containers
45     test: '{test}'
46
47 - xtesting-build-containers: &xtesting-build-containers
48     name: 'xtesting-build-containers'
49     <<: *xtesting-containers
50     ref_arg: '{ref_arg}'
51     path: '{path}'
52
53 - builder:
54     name: xtesting-pull-containers
55     builders:
56       - shell: |
57           set +x
58           if [ "{repo}" = "_" ]; then
59             image={container}:{tag}
60           elif [ "{port}" = "None" ]; then
61             image={repo}/{container}:{tag}
62           else
63             image={repo}:{port}/{container}:{tag}
64           fi
65           sudo docker pull $image
66
67 - builder:
68     name: xtesting-build-containers
69     builders:
70       - shell: |
71           set +x
72           if [ "{repo}" = "_" ]; then
73             image={container}:{tag}
74           elif [ "{port}" = "None" ]; then
75             image={repo}/{container}:{tag}
76           else
77             image={repo}:{port}/{container}:{tag}
78           fi
79           if [ "{ref_arg}" = "None" ]; then
80             build_arg=""
81           else
82             build_arg="--build-arg {ref_arg}={ref}"
83           fi
84           cd {path}
85           sudo docker build $build_arg \
86             --pull=false --no-cache --force-rm=true \
87             -t $image .
88
89 - builder:
90     name: xtesting-run-containers
91     builders:
92       - shell: |
93           set +ex
94           [ ! -z "$WORKSPACE" ] && sudo rm -rf $WORKSPACE/* || true
95           if [ "{repo}" = "_" ]; then
96             image={container}:{tag}
97           elif [ "{port}" = "None" ]; then
98             image={repo}/{container}:{tag}
99           else
100             image={repo}:{port}/{container}:{tag}
101           fi
102           sudo docker run --rm \
103             -v $WORKSPACE/../$JOB_NAME/results:/var/lib/xtesting/results \
104             -e DEBUG=true \
105             $image run_tests -t {test}
106           res=$?
107           gsutil -m cp -r $WORKSPACE/ \
108             gs://artifacts.opnfv.org/xtesting/$JOB_NAME-$BUILD_ID > /dev/null 2>&1
109           find $WORKSPACE -type f \
110             -printf \
111             "http://artifacts.opnfv.org/xtesting/$JOB_NAME-$BUILD_ID/%P\n"
112           exit $res
113
114 - builder:
115     name: xtesting-remove-images
116     builders:
117       - shell: |
118           set +x
119           if [ "{repo}" = "_" ]; then
120             image={container}:{tag}
121           elif [ "{port}" = "None" ]; then
122             image={repo}/{container}:{tag}
123           else
124             image={repo}:{port}/{container}:{tag}
125           fi
126           sudo docker rmi $image || true
127
128 - scm:
129     name: xtesting-scm
130     scm:
131       - git:
132           url: https://gerrit.opnfv.org/gerrit/functest-xtesting
133           refspec: '+refs/changes/*:refs/changes/*'
134           branches:
135             - '{ref}'
136
137 - job-template:
138     name: 'xtesting-{repo}-{container}-{tag}-pull'
139     parameters:
140       - xtesting-slave:
141           slave: '{slave}'
142     builders:
143       - xtesting-pull-containers:
144           <<: *xtesting-containers
145
146 - project:
147     name: 'xtesting-opnfv-xtesting-pull'
148     <<: *xtesting-params
149     container: 'xtesting'
150     jobs:
151       - 'xtesting-{repo}-{container}-{tag}-pull'
152
153 - job-template:
154     name: 'xtesting-{repo}-{container}-{tag}-rmi'
155     parameters:
156       - xtesting-slave:
157           slave: '{slave}'
158     builders:
159       - xtesting-remove-images:
160           <<: *xtesting-containers
161
162 - project:
163     name: 'xtesting-opnfv-xtesting-rmi'
164     <<: *xtesting-params
165     container: 'xtesting'
166     jobs:
167       - 'xtesting-{repo}-{container}-{tag}-rmi'
168
169 - job-template:
170     name: 'xtesting-{repo}-{container}-{tag}-{test}-run'
171     parameters:
172       - xtesting-slave:
173           slave: '{slave}'
174     builders:
175       - xtesting-run-containers:
176           <<: *xtesting-run-containers
177
178 - project:
179     name: 'xtesting-opnfv-xtesting'
180     <<: *xtesting-params
181     container: 'xtesting'
182     test:
183       - first
184       - second
185       - third
186       - fourth
187       - fifth
188       - sixth
189     jobs:
190       - 'xtesting-{repo}-{container}-{tag}-{test}-run'
191
192 - job-template:
193     name: 'xtesting-{tag}-daily'
194     project-type: multijob
195     triggers:
196       - timed: '@daily'
197     parameters:
198       - xtesting-slave:
199           slave: '{slave}'
200     properties:
201       - build-blocker:
202           use-build-blocker: true
203           blocking-level: 'NODE'
204           blocking-jobs:
205             - '^xtesting-{tag}-(daily|check|gate)$'
206     builders:
207       - multijob:
208           name: remove former images
209           projects:
210             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
211               <<: *xtesting-jobs
212       - multijob:
213           name: pull containers
214           projects:
215             - name: 'xtesting-opnfv-xtesting-{tag}-pull'
216               <<: *xtesting-jobs
217       - multijob:
218           name: opnfv/xtesting:{tag}
219           projects:
220             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
221               <<: *xtesting-jobs
222             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
223               <<: *xtesting-jobs
224             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
225               <<: *xtesting-jobs
226             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
227               <<: *xtesting-jobs
228             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
229               <<: *xtesting-jobs
230             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
231               <<: *xtesting-jobs
232
233 - job-template:
234     name: 'xtesting-{repo}-{container}-{tag}-gate'
235     parameters:
236       - xtesting-slave:
237           slave: '{slave}'
238     scm:
239       - xtesting-scm:
240           ref: $GERRIT_REFSPEC
241     builders:
242       - xtesting-build-containers:
243           <<: *xtesting-build-containers
244           ref: $GERRIT_REFSPEC
245
246 - job-template:
247     name: 'xtesting-{repo}-{container}-{tag}-check'
248     parameters:
249       - xtesting-slave:
250           slave: '{slave}'
251       - xtesting-branch:
252           branch: '{branch}'
253     scm:
254       - xtesting-scm:
255           ref: $branch
256     builders:
257       - xtesting-build-containers:
258           <<: *xtesting-build-containers
259           ref: $branch
260
261 - project:
262     name: 'xtesting-_-alpine-3.9-rmi'
263     repo: _
264     port:
265     container: alpine
266     tag: 3.9
267     slave: master
268     jobs:
269       - 'xtesting-{repo}-{container}-{tag}-rmi'
270
271 - project:
272     name: 'xtesting-_-alpine-3.9-pull'
273     repo: _
274     port:
275     container: alpine
276     tag: 3.9
277     slave: master
278     jobs:
279       - 'xtesting-{repo}-{container}-{tag}-pull'
280
281 - project:
282     name: xtesting-opnfv-xtesting-{tag}-build
283     <<: *xtesting-params
284     container: xtesting
285     ref_arg: BRANCH
286     path: docker
287     jobs:
288       - 'xtesting-{repo}-{container}-{tag}-gate'
289       - 'xtesting-{repo}-{container}-{tag}-check'
290
291 - job-template:
292     name: 'xtesting-{tag}-check'
293     project-type: multijob
294     parameters:
295       - xtesting-slave:
296           slave: '{slave}'
297       - xtesting-branch:
298           branch: '{branch}'
299     properties:
300       - build-blocker:
301           use-build-blocker: true
302           blocking-level: 'NODE'
303           blocking-jobs:
304             - '^xtesting-{tag}-(daily|check|gate)$'
305     builders:
306       - multijob:
307           name: remove former images
308           projects:
309             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
310               <<: *xtesting-jobs
311       - multijob:
312           name: remove dependencies
313           projects:
314             - name: 'xtesting-_-alpine-3.9-rmi'
315               <<: *xtesting-jobs
316       - multijob:
317           name: pull dependencies
318           projects:
319             - name: 'xtesting-_-alpine-3.9-pull'
320               <<: *xtesting-jobs
321       - multijob:
322           name: opnfv/xtesting
323           projects:
324             - name: 'xtesting-opnfv-xtesting-{tag}-check'
325               <<: *xtesting-jobs
326       - multijob:
327           name: opnfv/xtesting:{tag}
328           projects:
329             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
330               <<: *xtesting-jobs
331             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
332               <<: *xtesting-jobs
333             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
334               <<: *xtesting-jobs
335             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
336               <<: *xtesting-jobs
337             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
338               <<: *xtesting-jobs
339             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
340               <<: *xtesting-jobs
341
342 - trigger:
343     name: xtesting-patchset-created
344     triggers:
345       - gerrit:
346           server-name: 'gerrit.opnfv.org'
347           trigger-on:
348             - patchset-created-event
349             - comment-added-contains-event:
350                 comment-contains-value: 'recheck'
351             - comment-added-contains-event:
352                 comment-contains-value: 'reverify'
353           projects:
354             - project-compare-type: 'ANT'
355               project-pattern: 'functest-xtesting'
356               branches:
357                 - branch-compare-type: 'ANT'
358                   branch-pattern: '**/{branch}'
359           skip-vote:
360             successful: false
361             failed: false
362             unstable: false
363             notbuilt: false
364
365 - job-template:
366     name: 'xtesting-{tag}-gate'
367     project-type: multijob
368     triggers:
369       - xtesting-patchset-created:
370           branch: '{branch}'
371     parameters:
372       - xtesting-slave:
373           slave: '{slave}'
374     properties:
375       - build-blocker:
376           use-build-blocker: true
377           blocking-level: 'NODE'
378           blocking-jobs:
379             - '^xtesting-{tag}-(daily|check|gate)$'
380     builders:
381       - multijob:
382           name: remove former images
383           projects:
384             - name: 'xtesting-opnfv-xtesting-{tag}-rmi'
385               <<: *xtesting-jobs
386       - multijob:
387           name: remove dependencies
388           projects:
389             - name: 'xtesting-_-alpine-3.9-rmi'
390               <<: *xtesting-jobs
391       - multijob:
392           name: pull dependencies
393           projects:
394             - name: 'xtesting-_-alpine-3.9-pull'
395               <<: *xtesting-jobs
396       - multijob:
397           name: opnfv/xtesting
398           projects:
399             - name: 'xtesting-opnfv-xtesting-{tag}-gate'
400               <<: *xtesting-jobs
401       - multijob:
402           name: opnfv/xtesting:{tag}
403           projects:
404             - name: 'xtesting-opnfv-xtesting-{tag}-first-run'
405               <<: *xtesting-jobs
406             - name: 'xtesting-opnfv-xtesting-{tag}-second-run'
407               <<: *xtesting-jobs
408             - name: 'xtesting-opnfv-xtesting-{tag}-third-run'
409               <<: *xtesting-jobs
410             - name: 'xtesting-opnfv-xtesting-{tag}-fourth-run'
411               <<: *xtesting-jobs
412             - name: 'xtesting-opnfv-xtesting-{tag}-fifth-run'
413               <<: *xtesting-jobs
414             - name: 'xtesting-opnfv-xtesting-{tag}-sixth-run'
415               <<: *xtesting-jobs
416
417 - project:
418     name: 'xtesting'
419     <<: *xtesting-params
420     jobs:
421       - 'xtesting-{tag}-daily'
422       - 'xtesting-{tag}-check'
423       - 'xtesting-{tag}-gate'
424
425 - view:
426     name: xtesting
427     view-type: list
428     columns:
429       - status
430       - weather
431       - job
432       - last-success
433       - last-failure
434       - last-duration
435     regex: ^xtesting-[a-z]+-(daily|check|gate)$