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