9fa5633a027beb703b5af4518a07dc5632e0c3bd
[releng.git] / jjb / xci / xci-verify-jobs.yml
1 ---
2 - project:
3     name: 'opnfv-xci-verify'
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           successful: false
19           failed: false
20           unstable: false
21           notbuilt: false
22       - centos:
23           disabled: false
24           successful: true
25           failed: true
26           unstable: true
27           notbuilt: true
28       - opensuse:
29           disabled: false
30           successful: false
31           failed: false
32           unstable: false
33           notbuilt: false
34     # -------------------------------
35     # type
36     # -------------------------------
37     type:
38       - virtual
39     # -------------------------------
40     # patch verification phases
41     # -------------------------------
42     phase:
43       - 'deploy'
44       - 'healthcheck'
45     # -------------------------------
46     # jobs
47     # -------------------------------
48     jobs:
49       - 'xci-verify-{distro}-{type}-{stream}'
50       - 'xci-verify-{distro}-{phase}-{type}-{stream}'
51 # -------------------------------
52 # job templates
53 # -------------------------------
54 - job-template:
55     name: 'xci-verify-{distro}-{type}-{stream}'
56
57     project-type: multijob
58
59     disabled: '{obj:disabled}'
60
61     concurrent: true
62
63     properties:
64       - logrotate-default
65       - build-blocker:
66           use-build-blocker: true
67           blocking-jobs:
68             - 'xci-verify-{distro}-.*'
69             - 'bifrost-verify-{distro}-.*'
70             - 'bifrost-periodic-{distro}-.*'
71             - 'osa-verify-{distro}-.*'
72             - 'osa-periodic-{distro}-.*'
73           block-level: 'NODE'
74       - throttle:
75           max-per-node: 2
76           max-total: 10
77           categories:
78             - xci-verify-virtual
79           option: category
80
81     wrappers:
82       - ssh-agent-wrapper
83       - build-timeout:
84           timeout: 240
85       - fix-workspace-permissions
86
87     scm:
88       - git-scm-gerrit
89
90     triggers:
91       - gerrit:
92           server-name: 'gerrit.opnfv.org'
93           trigger-on:
94             - patchset-created-event:
95                 exclude-drafts: 'false'
96                 exclude-trivial-rebase: 'false'
97                 exclude-no-code-change: 'true'
98             - draft-published-event
99             - comment-added-contains-event:
100                 comment-contains-value: 'recheck'
101             - comment-added-contains-event:
102                 comment-contains-value: 'reverify'
103           projects:
104             - project-compare-type: 'ANT'
105               project-pattern: '{project}'
106               branches:
107                 - branch-compare-type: 'ANT'
108                   branch-pattern: '**/{branch}'
109               disable-strict-forbidden-file-verification: 'true'
110               forbidden-file-paths:
111                 - compare-type: ANT
112                   pattern: 'prototypes/**'
113                 - compare-type: ANT
114                   pattern: 'upstream/**'
115                 - compare-type: ANT
116                   pattern: '**/README.rst'
117                 - compare-type: ANT
118                   pattern: 'docs/**'
119                 - compare-type: ANT
120                   pattern: 'xci/scripts/vm/**'
121           readable-message: true
122           custom-url: '* $JOB_NAME $BUILD_URL'
123           skip-vote:
124             successful: '{obj:successful}'
125             failed: '{obj:failed}'
126             unstable: '{obj:unstable}'
127             notbuilt: '{obj:notbuilt}'
128
129     parameters:
130       - project-parameter:
131           project: '{project}'
132           branch: '{branch}'
133       - label:
134           name: SLAVE_LABEL
135           default: 'xci-virtual'
136       - string:
137           name: CLEAN_DIB_IMAGES
138           default: 'true'
139       - string:
140           name: GIT_BASE
141           default: https://gerrit.opnfv.org/gerrit/$PROJECT
142           description: 'Git URL to use on this Jenkins Slave'
143
144     builders:
145       - description-setter:
146           description: "Built on $NODE_NAME"
147       - multijob:
148           name: deploy
149           condition: SUCCESSFUL
150           projects:
151             - name: 'xci-verify-{distro}-deploy-{type}-{stream}'
152               current-parameters: true
153               predefined-parameters: |
154                 DISTRO={distro}
155                 DEPLOY_SCENARIO=os-nosdn-nofeature-noha
156                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
157                 GERRIT_BRANCH=$GERRIT_BRANCH
158                 GERRIT_REFSPEC=$GERRIT_REFSPEC
159                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
160                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
161               node-parameters: true
162               kill-phase-on: FAILURE
163               abort-all-job: true
164       - multijob:
165           name: healthcheck
166           condition: SUCCESSFUL
167           projects:
168             - name: 'xci-verify-{distro}-healthcheck-{type}-{stream}'
169               current-parameters: true
170               predefined-parameters: |
171                 DISTRO={distro}
172                 DEPLOY_SCENARIO=os-nosdn-nofeature-noha
173                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
174                 FUNCTEST_MODE=tier
175                 FUNCTEST_TIER=healthcheck
176                 GERRIT_BRANCH=$GERRIT_BRANCH
177                 GERRIT_REFSPEC=$GERRIT_REFSPEC
178                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
179                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
180               node-parameters: true
181               kill-phase-on: NEVER
182               abort-all-job: true
183
184 - job-template:
185     name: 'xci-verify-{distro}-{phase}-{type}-{stream}'
186
187     disabled: false
188
189     concurrent: true
190
191     properties:
192       - logrotate-default
193       - build-blocker:
194           use-build-blocker: true
195           blocking-jobs:
196             - '.*-bifrost-verify-.*'
197             - '.*-bifrost-periodic-.*'
198             - 'osa-verify-.*'
199             - 'osa-periodic-.*'
200           block-level: 'NODE'
201
202     parameters:
203       - string:
204           name: PROJECT
205           default: 'releng-xci'
206       - string:
207           name: DISTRO
208           default: 'ubuntu'
209       - string:
210           name: DEPLOY_SCENARIO
211           default: 'os-nosdn-nofeature-noha'
212       - string:
213           name: FUNCTEST_MODE
214           default: 'tier'
215       - string:
216           name: FUNCTEST_SUITE_NAME
217           default: 'healthcheck'
218       - string:
219           name: XCI_FLAVOR
220           default: 'mini'
221       - string:
222           name: CLEAN_DIB_IMAGES
223           default: 'true'
224       - string:
225           name: OPNFV_RELENG_DEV_PATH
226           default: $WORKSPACE/
227       - string:
228           name: INSTALLER_TYPE
229           default: 'osa'
230       - string:
231           name: GIT_BASE
232           default: https://gerrit.opnfv.org/gerrit/$PROJECT
233           description: 'Git URL to use on this Jenkins Slave'
234
235     wrappers:
236       - ssh-agent-wrapper
237       - build-timeout:
238           timeout: 240
239       - fix-workspace-permissions
240
241     scm:
242       - git-scm-gerrit
243
244     builders:
245       - description-setter:
246           description: "Built on $NODE_NAME"
247       - 'xci-verify-{phase}-macro'
248
249 # -------------------------------
250 # builder macros
251 # -------------------------------
252 - builder:
253     name: 'xci-verify-deploy-macro'
254     builders:
255       - shell: |
256           #!/bin/bash
257
258           # skip the deployment if the patch doesn't impact the deployment
259           if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
260               echo "Skipping the deployment!"
261               exit 0
262           fi
263
264           cd $WORKSPACE
265
266           # The start-new-vm.sh script will copy the entire releng-xci directory
267           # so lets prepare the test script now so it can be copied by the script.
268           # Please do not move it elsewhere or you would have to move it to the VM
269           # yourself.
270           cat > xci_test.sh<<EOF
271           #!/bin/bash
272           export DISTRO=$DISTRO
273           export DEPLOY_SCENARIO=$DEPLOY_SCENARIO
274           export FUNCTEST_MODE=$FUNCTEST_MODE
275           export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
276           export XCI_FLAVOR=$XCI_FLAVOR
277           export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
278           export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/
279           export INSTALLER_TYPE=$INSTALLER_TYPE
280           export GIT_BASE=$GIT_BASE
281           export JENKINS_HOME=$JENKINS_HOME
282
283           cd xci
284           ./xci-deploy.sh
285           EOF
286           chmod a+x xci_test.sh
287
288           export XCI_BUILD_CLEAN_VM_OS=false
289           export XCI_UPDATE_CLEAN_VM_OS=true
290
291           ./xci/scripts/vm/start-new-vm.sh $DISTRO
292       - shell: |
293           #!/bin/bash
294
295           # skip the deployment if the patch doesn't impact the deployment
296           if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
297               echo "Skipping the deployment!"
298               exit 0
299           fi
300
301           ssh -F $HOME/.ssh/xci-vm-config ${DISTRO}_xci_vm "cd releng-xci && ./xci_test.sh"
302
303
304 - builder:
305     name: 'xci-verify-healthcheck-macro'
306     builders:
307       - shell: |
308           #!/bin/bash
309
310           # skip the healthcheck if the patch doesn't impact the deployment
311           if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
312               echo "Skipping the healthcheck!"
313               exit 0
314           fi
315
316           echo "Hello World!"
317       - shell: |
318           #!/bin/bash
319
320           # skip the deployment if the patch doesn't impact the deployment
321           if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
322               echo "Skipping the deployment!"
323               exit 0
324           fi
325
326           sudo virsh destroy ${DISTRO}_xci_vm
327           sudo virsh undefine ${DISTRO}_xci_vm
328
329 # this will be enabled once the xci is prepared
330 # - builder:
331 #    name: 'xci-verify-healthcheck-macro'
332 #    builders:
333 #        - shell:
334 #            !include-raw: ../../utils/fetch_os_creds.sh
335 #        - shell:
336 #            !include-raw: ../functest/functest-alpine.sh