1b2b74af89e4a506e88945d297e27ff6ab864063
[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               file-paths:
111                 - compare-type: ANT
112                   pattern: 'bifrost/**'
113                 - compare-type: ANT
114                   pattern: 'xci/**'
115               forbidden-file-paths:
116                 - compare-type: ANT
117                   pattern: 'prototypes/**'
118                 - compare-type: ANT
119                   pattern: 'upstream/**'
120                 - compare-type: ANT
121                   pattern: '**/README.rst'
122                 - compare-type: ANT
123                   pattern: 'docs/**'
124           readable-message: true
125           custom-url: '* $JOB_NAME $BUILD_URL'
126           skip-vote:
127             successful: '{obj:successful}'
128             failed: '{obj:failed}'
129             unstable: '{obj:unstable}'
130             notbuilt: '{obj:notbuilt}'
131
132     parameters:
133       - project-parameter:
134           project: '{project}'
135           branch: '{branch}'
136       - label:
137           name: SLAVE_LABEL
138           default: 'xci-virtual'
139       - string:
140           name: CLEAN_DIB_IMAGES
141           default: 'true'
142       - string:
143           name: GIT_BASE
144           default: https://gerrit.opnfv.org/gerrit/$PROJECT
145           description: 'Git URL to use on this Jenkins Slave'
146
147     builders:
148       - description-setter:
149           description: "Built on $NODE_NAME"
150       - multijob:
151           name: deploy
152           condition: SUCCESSFUL
153           projects:
154             - name: 'xci-verify-{distro}-deploy-{type}-{stream}'
155               current-parameters: true
156               predefined-parameters: |
157                 DISTRO={distro}
158                 DEPLOY_SCENARIO=os-nosdn-nofeature-noha
159                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
160                 GERRIT_BRANCH=$GERRIT_BRANCH
161                 GERRIT_REFSPEC=$GERRIT_REFSPEC
162                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
163                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
164               node-parameters: true
165               kill-phase-on: FAILURE
166               abort-all-job: true
167       - multijob:
168           name: healthcheck
169           condition: SUCCESSFUL
170           projects:
171             - name: 'xci-verify-{distro}-healthcheck-{type}-{stream}'
172               current-parameters: true
173               predefined-parameters: |
174                 DISTRO={distro}
175                 DEPLOY_SCENARIO=os-nosdn-nofeature-noha
176                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
177                 FUNCTEST_MODE=tier
178                 FUNCTEST_TIER=healthcheck
179                 GERRIT_BRANCH=$GERRIT_BRANCH
180                 GERRIT_REFSPEC=$GERRIT_REFSPEC
181                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
182                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
183               node-parameters: true
184               kill-phase-on: NEVER
185               abort-all-job: true
186
187 - job-template:
188     name: 'xci-verify-{distro}-{phase}-{type}-{stream}'
189
190     disabled: false
191
192     concurrent: true
193
194     properties:
195       - logrotate-default
196       - build-blocker:
197           use-build-blocker: true
198           blocking-jobs:
199             - '.*-bifrost-verify-.*'
200             - '.*-bifrost-periodic-.*'
201             - 'osa-verify-.*'
202             - 'osa-periodic-.*'
203           block-level: 'NODE'
204
205     parameters:
206       - string:
207           name: PROJECT
208           default: 'releng-xci'
209       - string:
210           name: DISTRO
211           default: 'ubuntu'
212       - string:
213           name: DEPLOY_SCENARIO
214           default: 'os-nosdn-nofeature-noha'
215       - string:
216           name: FUNCTEST_MODE
217           default: 'tier'
218       - string:
219           name: FUNCTEST_SUITE_NAME
220           default: 'healthcheck'
221       - string:
222           name: XCI_FLAVOR
223           default: 'mini'
224       - string:
225           name: CLEAN_DIB_IMAGES
226           default: 'true'
227       - string:
228           name: OPNFV_RELENG_DEV_PATH
229           default: $WORKSPACE/
230       - string:
231           name: INSTALLER_TYPE
232           default: 'osa'
233       - string:
234           name: GIT_BASE
235           default: https://gerrit.opnfv.org/gerrit/$PROJECT
236           description: 'Git URL to use on this Jenkins Slave'
237
238     wrappers:
239       - ssh-agent-wrapper
240       - build-timeout:
241           timeout: 240
242       - fix-workspace-permissions
243
244     scm:
245       - git-scm-gerrit
246
247     builders:
248       - description-setter:
249           description: "Built on $NODE_NAME"
250       - 'xci-verify-{phase}-macro'
251
252 # -------------------------------
253 # builder macros
254 # -------------------------------
255 - builder:
256     name: 'xci-verify-deploy-macro'
257     builders:
258       - shell: |
259           #!/bin/bash
260
261           # skip the deployment if the patch doesn't impact the deployment
262           if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
263               echo "Skipping the deployment!"
264               exit 0
265           fi
266
267           cd $WORKSPACE
268
269           # The start-new-vm.sh script will copy the entire releng-xci directory
270           # so lets prepare the test script now so it can be copied by the script.
271           # Please do not move it elsewhere or you would have to move it to the VM
272           # yourself.
273           cat > xci_test.sh<<EOF
274           #!/bin/bash
275           export DISTRO=$DISTRO
276           export DEPLOY_SCENARIO=$DEPLOY_SCENARIO
277           export FUNCTEST_MODE=$FUNCTEST_MODE
278           export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
279           export XCI_FLAVOR=$XCI_FLAVOR
280           export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
281           export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/
282           export INSTALLER_TYPE=$INSTALLER_TYPE
283           export GIT_BASE=$GIT_BASE
284           export JENKINS_HOME=$JENKINS_HOME
285
286           cd xci
287           ./xci-deploy.sh
288           EOF
289           chmod a+x xci_test.sh
290
291           export XCI_BUILD_CLEAN_VM_OS=false
292           export XCI_UPDATE_CLEAN_VM_OS=true
293
294           ./xci/scripts/vm/start-new-vm.sh $DISTRO
295       - shell: |
296           #!/bin/bash
297
298           # skip the deployment if the patch doesn't impact the deployment
299           if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
300               echo "Skipping the deployment!"
301               exit 0
302           fi
303
304           ssh -F $HOME/.ssh/xci-vm-config ${DISTRO}_xci_vm "cd releng-xci && ./xci_test.sh"
305
306
307 - builder:
308     name: 'xci-verify-healthcheck-macro'
309     builders:
310       - shell: |
311           #!/bin/bash
312
313           # skip the healthcheck if the patch doesn't impact the deployment
314           if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
315               echo "Skipping the healthcheck!"
316               exit 0
317           fi
318
319           echo "Hello World!"
320       - shell: |
321           #!/bin/bash
322
323           # skip the deployment if the patch doesn't impact the deployment
324           if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
325               echo "Skipping the deployment!"
326               exit 0
327           fi
328
329           sudo virsh destroy ${DISTRO}_xci_vm
330           sudo virsh undefine ${DISTRO}_xci_vm
331
332 # this will be enabled once the xci is prepared
333 # - builder:
334 #    name: 'xci-verify-healthcheck-macro'
335 #    builders:
336 #        - shell:
337 #            !include-raw: ../../utils/fetch_os_creds.sh
338 #        - shell:
339 #            !include-raw: ../functest/functest-alpine.sh