xci: Create post merge jobs to promote scenarios
[releng.git] / jjb / xci / xci-merge-jobs.yml
1 ---
2 - project:
3     name: 'opnfv-xci-merge'
4
5     project: releng-xci
6     # -------------------------------
7     # branches
8     # -------------------------------
9     stream:
10       - master:
11           branch: '{stream}'
12     # -------------------------------
13     # distros
14     # -------------------------------
15     distro:
16       - ubuntu:
17           disabled: false
18       - centos:
19           disabled: false
20       - opensuse:
21           disabled: false
22     # -------------------------------
23     # scenarios
24     # -------------------------------
25     scenario:
26       - 'os-odl-sfc':
27           project: sfc
28     # -------------------------------
29     # type
30     # -------------------------------
31     type:
32       - virtual
33     # -------------------------------
34     # postmerge promotion phases
35     # -------------------------------
36     phase:
37       - 'deploy'
38       - 'healthcheck'
39     # -------------------------------
40     # jobs
41     # -------------------------------
42     jobs:
43       - 'xci-{scenario}-{type}-merge-{stream}'
44       - 'xci-{scenario}-{type}-promote-merge-{stream}'
45       - 'xci-merge-{distro}-{type}-{stream}'
46       - 'xci-merge-{distro}-{phase}-{type}-{stream}'
47 # -------------------------------
48 # job templates
49 # -------------------------------
50 - job-template:
51     name: 'xci-{scenario}-{type}-merge-{stream}'
52
53     project-type: multijob
54
55     disabled: '{obj:disabled}'
56
57     concurrent: false
58
59     properties:
60       - logrotate-default
61
62     wrappers:
63       - ssh-agent-wrapper
64       - build-timeout:
65           timeout: 240
66       - fix-workspace-permissions
67
68     scm:
69       - git-scm-gerrit
70
71     triggers:
72       - gerrit:
73           server-name: 'gerrit.opnfv.org'
74           trigger-on:
75             - change-merged-event
76             - comment-added-contains-event:
77                 comment-contains-value: 'remerge'
78           projects:
79             - project-compare-type: 'ANT'
80               project-pattern: '{obj:project}'
81               branches:
82                 - branch-compare-type: 'ANT'
83                   branch-pattern: '**/{branch}'
84               disable-strict-forbidden-file-verification: 'true'
85               file-paths:
86                 - compare-type: ANT
87                   pattern: 'scenarios/**'
88           readable-message: true
89           custom-url: '* $JOB_NAME $BUILD_URL'
90
91     parameters:
92       - project-parameter:
93           project: $GERRIT_PROJECT
94           branch: '{branch}'
95       - label:
96           name: SLAVE_LABEL
97           default: 'xci-virtual'
98       - string:
99           name: DISTRO
100           default: 'all'
101       - string:
102           name: CLEAN_DIB_IMAGES
103           default: 'true'
104       - string:
105           name: GIT_BASE
106           default: https://gerrit.opnfv.org/gerrit/$PROJECT
107           description: 'Git URL to use on this Jenkins Slave'
108
109     builders:
110       - description-setter:
111           description: "Node: $NODE_NAME"
112       - 'xci-merge-set-scenario-macro'
113       - multijob:
114           name: deploy and test
115           condition: SUCCESSFUL
116           projects:
117             - name: 'xci-merge-opensuse-{type}-{stream}'
118               current-parameters: false
119               predefined-parameters: |
120                 DISTRO=opensuse
121                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
122                 GERRIT_PROJECT=$GERRIT_PROJECT
123                 GERRIT_BRANCH=$GERRIT_BRANCH
124                 GERRIT_REFSPEC=$GERRIT_REFSPEC
125                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
126                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
127               node-parameters: false
128               kill-phase-on: FAILURE
129               abort-all-job: true
130             - name: 'xci-merge-ubuntu-{type}-{stream}'
131               current-parameters: false
132               predefined-parameters: |
133                 DISTRO=ubuntu
134                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
135                 GERRIT_PROJECT=$GERRIT_PROJECT
136                 GERRIT_BRANCH=$GERRIT_BRANCH
137                 GERRIT_REFSPEC=$GERRIT_REFSPEC
138                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
139                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
140               node-parameters: false
141               kill-phase-on: FAILURE
142               abort-all-job: true
143             - name: 'xci-merge-centos-{type}-{stream}'
144               current-parameters: false
145               predefined-parameters: |
146                 DISTRO=centos
147                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
148                 GERRIT_PROJECT=$GERRIT_PROJECT
149                 GERRIT_BRANCH=$GERRIT_BRANCH
150                 GERRIT_REFSPEC=$GERRIT_REFSPEC
151                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
152                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
153               node-parameters: false
154               kill-phase-on: FAILURE
155               abort-all-job: true
156       - inject:
157           properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
158       - multijob:
159           name: promote
160           condition: SUCCESSFUL
161           projects:
162             - name: 'xci-{scenario}-{type}-promote-merge-{stream}'
163               current-parameters: true
164               predefined-parameters: |
165                 GERRIT_PROJECT=$GERRIT_PROJECT
166                 GERRIT_BRANCH=$GERRIT_BRANCH
167                 GERRIT_REFSPEC=$GERRIT_REFSPEC
168                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
169                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
170               node-parameters: true
171               kill-phase-on: NEVER
172               abort-all-job: true
173
174 - job-template:
175     name: 'xci-merge-{distro}-{type}-{stream}'
176
177     project-type: multijob
178
179     disabled: '{obj:disabled}'
180
181     concurrent: true
182
183     properties:
184       - logrotate-default
185       - build-blocker:
186           use-build-blocker: true
187           blocking-jobs:
188             - 'xci-verify-{distro}-.*'
189             - 'xci-merge-{distro}-.*'
190             - 'openstack-bifrost-verify-{distro}-.*'
191             - 'xci-osa-verify-{distro}-.*'
192             - 'xci-osa-periodic-{distro}-.*'
193           block-level: 'NODE'
194       - throttle:
195           max-per-node: 1
196           max-total: 3
197           categories:
198             - xci-verify-virtual
199           option: category
200
201     wrappers:
202       - ssh-agent-wrapper
203       - build-timeout:
204           timeout: 240
205       - fix-workspace-permissions
206
207     scm:
208       - git-scm-gerrit
209
210     parameters:
211       - project-parameter:
212           project: $GERRIT_PROJECT
213           branch: '{branch}'
214       - label:
215           name: SLAVE_LABEL
216           default: 'xci-virtual'
217       - string:
218           name: DISTRO
219           default: '{distro}'
220       - string:
221           name: CLEAN_DIB_IMAGES
222           default: 'true'
223       - string:
224           name: GIT_BASE
225           default: https://gerrit.opnfv.org/gerrit/$PROJECT
226           description: 'Git URL to use on this Jenkins Slave'
227
228     builders:
229       - 'xci-merge-set-scenario-macro'
230       - inject:
231           properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
232       - description-setter:
233           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
234       - multijob:
235           name: deploy
236           condition: SUCCESSFUL
237           projects:
238             - name: 'xci-merge-{distro}-deploy-{type}-{stream}'
239               current-parameters: true
240               predefined-parameters: |
241                 DISTRO={distro}
242                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
243                 GERRIT_PROJECT=$GERRIT_PROJECT
244                 GERRIT_BRANCH=$GERRIT_BRANCH
245                 GERRIT_REFSPEC=$GERRIT_REFSPEC
246                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
247                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
248               node-parameters: true
249               kill-phase-on: FAILURE
250               abort-all-job: true
251       - multijob:
252           name: healthcheck
253           condition: SUCCESSFUL
254           projects:
255             - name: 'xci-merge-{distro}-healthcheck-{type}-{stream}'
256               current-parameters: true
257               predefined-parameters: |
258                 DISTRO={distro}
259                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
260                 GERRIT_PROJECT=$GERRIT_PROJECT
261                 GERRIT_BRANCH=$GERRIT_BRANCH
262                 GERRIT_REFSPEC=$GERRIT_REFSPEC
263                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
264                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
265                 FUNCTEST_MODE=tier
266                 FUNCTEST_TIER=healthcheck
267               node-parameters: true
268               kill-phase-on: NEVER
269               abort-all-job: true
270
271     publishers:
272       - postbuildscript:
273           script-only-if-succeeded: false
274           script-only-if-failed: false
275           builders:
276             - shell:
277                 !include-raw: ./xci-cleanup.sh
278
279 - job-template:
280     name: 'xci-merge-{distro}-{phase}-{type}-{stream}'
281
282     disabled: false
283
284     concurrent: true
285
286     properties:
287       - logrotate-default
288       - build-blocker:
289           use-build-blocker: true
290           blocking-jobs:
291             - '.*-bifrost-verify-.*'
292             - '.*-bifrost-periodic-.*'
293             - 'osa-verify-.*'
294             - 'osa-periodic-.*'
295           block-level: 'NODE'
296
297     parameters:
298       - string:
299           name: PROJECT
300           default: $GERRIT_PROJECT
301       - string:
302           name: DISTRO
303           default: 'ubuntu'
304       - string:
305           name: FUNCTEST_MODE
306           default: 'tier'
307       - string:
308           name: FUNCTEST_SUITE_NAME
309           default: 'healthcheck'
310       - string:
311           name: XCI_FLAVOR
312           default: 'mini'
313       - string:
314           name: CLEAN_DIB_IMAGES
315           default: 'true'
316       - string:
317           name: OPNFV_RELENG_DEV_PATH
318           default: $WORKSPACE/
319       - string:
320           name: GIT_BASE
321           default: https://gerrit.opnfv.org/gerrit/$PROJECT
322           description: 'Git URL to use on this Jenkins Slave'
323
324     wrappers:
325       - inject:
326           properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
327       - ssh-agent-wrapper
328       - build-timeout:
329           timeout: 240
330       - fix-workspace-permissions
331
332     scm:
333       - git-scm-gerrit
334
335     builders:
336       - description-setter:
337           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
338       - 'xci-merge-{phase}-macro'
339
340 - job-template:
341     name: 'xci-{scenario}-{type}-promote-merge-{stream}'
342
343     disabled: false
344
345     concurrent: false
346
347     properties:
348       - logrotate-default
349
350     parameters:
351       - string:
352           name: PROJECT
353           default: $GERRIT_PROJECT
354       - string:
355           name: DISTRO
356           default: 'all'
357       - string:
358           name: OPNFV_RELENG_DEV_PATH
359           default: $WORKSPACE/
360       - string:
361           name: GIT_BASE
362           default: https://gerrit.opnfv.org/gerrit/$PROJECT
363           description: 'Git URL to use on this Jenkins Slave'
364
365     wrappers:
366       - inject:
367           properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
368       - ssh-agent-wrapper
369       - build-timeout:
370           timeout: 240
371       - fix-workspace-permissions
372
373     builders:
374       - description-setter:
375           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
376       - 'xci-merge-promote-macro'
377
378 # -------------------------------
379 # builder macros
380 # -------------------------------
381 - builder:
382     name: 'xci-merge-set-scenario-macro'
383     builders:
384       - shell:
385           !include-raw: ./xci-set-scenario.sh
386
387 - builder:
388     name: 'xci-merge-deploy-macro'
389     builders:
390       - shell: |
391           #!/bin/bash
392           echo "Hello World"
393
394 - builder:
395     name: 'xci-merge-healthcheck-macro'
396     builders:
397       - shell: |
398           #!/bin/bash
399           echo "Hello World"
400
401 - builder:
402     name: 'xci-merge-promote-macro'
403     builders:
404       - shell: |
405           #!/bin/bash
406           echo "Hello World"