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