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