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