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