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