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