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