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