xci: Execute prepare-tests.sh to prepare OPNFV VM
[releng.git] / jjb / xci / xci-daily-jobs.yaml
1 ---
2 - project:
3     project: 'releng-xci'
4
5     name: 'xci-daily'
6
7     # -------------------------------
8     # Branch Anchors
9     # -------------------------------
10     master: &master
11       stream: master
12       opnfv-releng-version: master
13       gs-pathname: ''
14
15     # -------------------------------
16     # Scenarios
17     # -------------------------------
18     scenario:
19       - 'os-nosdn-nofeature-noha':
20           auto-trigger-name: 'daily-trigger-disabled'
21           deploy-scenario: 'os-nosdn-nofeature'
22           installer-type: 'osa'
23           xci-flavor: 'mini'
24       - 'os-nosdn-osm-noha':
25           auto-trigger-name: 'daily-trigger-disabled'
26           deploy-scenario: 'os-nosdn-osm'
27           installer-type: 'osa'
28           xci-flavor: 'mini'
29       - 'os-odl-nofeature-noha':
30           auto-trigger-name: 'daily-trigger-disabled'
31           deploy-scenario: 'os-odl-nofeature'
32           installer-type: 'osa'
33           xci-flavor: 'mini'
34       - 'os-odl-bgpvpn-noha':
35           auto-trigger-name: 'daily-trigger-disabled'
36           deploy-scenario: 'os-odl-bgpvpn'
37           installer-type: 'osa'
38           xci-flavor: 'mini'
39       - 'os-odl-sfc-noha':
40           auto-trigger-name: 'daily-trigger-disabled'
41           deploy-scenario: 'os-odl-sfc'
42           installer-type: 'osa'
43           xci-flavor: 'mini'
44       - 'k8-nosdn-nofeature-noha':
45           auto-trigger-name: 'daily-trigger-disabled'
46           deploy-scenario: 'k8-nosdn-nofeature'
47           installer-type: 'kubespray'
48           xci-flavor: 'mini'
49       - 'k8-canal-nofeature-noha':
50           auto-trigger-name: 'daily-trigger-disabled'
51           deploy-scenario: 'k8-canal-nofeature'
52           installer-type: 'kubespray'
53           xci-flavor: 'mini'
54       - 'k8-calico-nofeature-noha':
55           auto-trigger-name: 'daily-trigger-disabled'
56           deploy-scenario: 'k8-calico-nofeature'
57           installer-type: 'kubespray'
58           xci-flavor: 'mini'
59       - 'k8-contiv-nofeature-noha':
60           auto-trigger-name: 'daily-trigger-disabled'
61           deploy-scenario: 'k8-contiv-nofeature'
62           installer-type: 'kubespray'
63           xci-flavor: 'mini'
64       - 'k8-flannel-nofeature-noha':
65           auto-trigger-name: 'daily-trigger-disabled'
66           deploy-scenario: 'k8-flannel-nofeature'
67           installer-type: 'kubespray'
68           xci-flavor: 'mini'
69       - 'k8-nosdn-istio-noha':
70           auto-trigger-name: 'daily-trigger-disabled'
71           deploy-scenario: 'k8-nosdn-istio'
72           installer-type: 'kubespray'
73           xci-flavor: 'mini'
74
75     # -------------------------------
76     # XCI PODs
77     # -------------------------------
78     pod:
79       - virtual:
80           <<: *master
81
82     # -------------------------------
83     # Supported Distros
84     # -------------------------------
85     distro:
86       - 'ubuntu':
87           disabled: false
88           slave-label: xci-virtual
89       - 'centos':
90           disabled: true
91           slave-label: xci-virtual
92       - 'opensuse':
93           disabled: false
94           slave-label: xci-virtual
95
96     # -------------------------------
97     #        Phases
98     # -------------------------------
99     phase:
100       - 'deploy'
101       - 'functest'
102
103     # -------------------------------
104     # jobs
105     # -------------------------------
106     jobs:
107       - 'xci-{scenario}-{pod}-{distro}-daily-{stream}'
108       - 'xci-{phase}-{pod}-{distro}-daily-{stream}'
109
110 # -------------------------------
111 # job templates
112 # -------------------------------
113 - job-template:
114     name: 'xci-{scenario}-{pod}-{distro}-daily-{stream}'
115
116     disabled: '{obj:disabled}'
117
118     concurrent: false
119
120     properties:
121       - build-blocker:
122           use-build-blocker: true
123           blocking-jobs:
124             - '^xci-verify.*'
125             - '^xci-merge.*'
126             - '^xci-os.*'
127             - '^xci-k8.*'
128             - '^xci-deploy.*'
129             - '^xci-functest.*'
130             - '^bifrost-.*periodic.*'
131             - '^osa-.*periodic.*'
132           block-level: 'NODE'
133       - logrotate-default
134
135     parameters:
136       - string:
137           name: DEPLOY_SCENARIO
138           default: '{deploy-scenario}'
139       - string:
140           name: INSTALLER_TYPE
141           default: '{installer-type}'
142       - string:
143           name: XCI_FLAVOR
144           default: '{xci-flavor}'
145       - label:
146           name: SLAVE_LABEL
147           default: '{slave-label}'
148       - string:
149           name: XCI_DISTRO
150           default: '{distro}'
151       - string:
152           name: FUNCTEST_MODE
153           default: 'tier'
154       - string:
155           name: FUNCTEST_SUITE_NAME
156           default: 'healthcheck'
157       - string:
158           name: CI_LOOP
159           default: 'daily'
160       - string:
161           name: GIT_BASE
162           default: https://gerrit.opnfv.org/gerrit/$PROJECT
163           description: 'Git URL to use on this Jenkins Slave'
164
165     triggers:
166       - '{auto-trigger-name}'
167
168     wrappers:
169       - ssh-agent-wrapper
170       - build-timeout:
171           timeout: 240
172       - fix-workspace-permissions
173
174     builders:
175       - description-setter:
176           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
177       - trigger-builds:
178           - project: 'xci-deploy-{pod}-{distro}-daily-{stream}'
179             current-parameters: false
180             predefined-parameters: |
181               DEPLOY_SCENARIO=$DEPLOY_SCENARIO
182               INSTALLER_TYPE=$INSTALLER_TYPE
183               XCI_FLAVOR=$XCI_FLAVOR
184               CI_LOOP=$CI_LOOP
185               XCI_DISTRO=$XCI_DISTRO
186             same-node: true
187             block: true
188       - trigger-builds:
189           - project: 'xci-functest-{pod}-{distro}-daily-{stream}'
190             current-parameters: false
191             predefined-parameters: |
192               DEPLOY_SCENARIO=$DEPLOY_SCENARIO
193               INSTALLER_TYPE=$INSTALLER_TYPE
194               XCI_FLAVOR=$XCI_FLAVOR
195               CI_LOOP=$CI_LOOP
196               XCI_DISTRO=$XCI_DISTRO
197               FUNCTEST_MODE=$FUNCTEST_MODE
198               FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
199             same-node: true
200             block: true
201             block-thresholds:
202               build-step-failure-threshold: 'never'
203               failure-threshold: 'never'
204               unstable-threshold: 'FAILURE'
205
206     publishers:
207       # yamllint disable rule:line-length
208       # yamllint enable rule:line-length
209       - email-jenkins-admins-on-failure
210
211 - job-template:
212     name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
213
214     disabled: false
215
216     concurrent: true
217
218     properties:
219       - build-blocker:
220           use-build-blocker: true
221           blocking-jobs:
222             - '^xci-verify.*'
223             - '^xci-merge.*'
224             - '^xci-deploy.*'
225             - '^xci-functest.*'
226             - '^bifrost-.*periodic.*'
227             - '^osa-.*periodic.*'
228           block-level: 'NODE'
229       - throttle:
230           enabled: true
231           max-per-node: 1
232           option: 'project'
233       - logrotate-default
234
235     wrappers:
236       - ssh-agent-wrapper
237       - build-timeout:
238           timeout: 240
239       - fix-workspace-permissions
240
241     scm:
242       - git-scm
243
244     parameters:
245       - project-parameter:
246           project: '{project}'
247           branch: '{opnfv-releng-version}'
248       - string:
249           name: DEPLOY_SCENARIO
250           default: 'os-nosdn-nofeature-noha'
251       - string:
252           name: INSTALLER_TYPE
253           default: 'osa'
254       - string:
255           name: XCI_FLAVOR
256           default: 'mini'
257       - string:
258           name: XCI_DISTRO
259           default: 'ubuntu'
260       - label:
261           name: SLAVE_LABEL
262           default: '{slave-label}'
263       - string:
264           name: FUNCTEST_MODE
265           default: 'tier'
266       - string:
267           name: FUNCTEST_SUITE_NAME
268           default: 'healthcheck'
269       - string:
270           name: CI_LOOP
271           default: 'daily'
272       - string:
273           name: GIT_BASE
274           default: https://gerrit.opnfv.org/gerrit/$PROJECT
275
276     builders:
277       - description-setter:
278           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
279       - 'xci-daily-{phase}-macro'
280
281 # --------------------------
282 # builder macros
283 # --------------------------
284 # These need to be properly fixed once the basic deployment and functest
285 # jobs are working outside of clean vm.
286 # One of the ugly fixes is moving functest preparation step into the
287 # deployment job itself since functest preparation requires some of the
288 # things from deployment job. With clean VM, this wasn't an issue
289 # since everything was on clean VM. When we move things out of clean
290 # VM, things are done in workspaces of the jobs that are different.
291 #
292 # Apart from these things, we will need to go through the scripts
293 # used for verify jobs and make them updated in order to be able to
294 # use them for jobs that don't use clean VM.
295 - builder:
296     name: 'xci-daily-deploy-macro'
297     builders:
298       - shell: |
299           #!/bin/bash
300           set -o errexit
301           set -o pipefail
302
303           echo "Cleaning the leftovers from the earlier run"
304           echo "---------------------------------------------------------------------------------"
305           for vm in $(sudo virsh list --all --name | grep -v xci_vm); do
306               echo "Removing $vm"
307               sudo virsh destroy $vm > /dev/null 2>&1 || true
308               sudo virsh undefine $vm > /dev/null 2>&1 || true
309           done
310           echo "---------------------------------------------------------------------------------"
311
312           cd $WORKSPACE/xci && ./xci-deploy.sh
313
314           echo "Prepare OPNFV VM for Tests"
315           echo "---------------------------------------------------------------------------------"
316           export XCI_PATH=$WORKSPACE
317           export XCI_VENV=${XCI_PATH}/venv
318           source $XCI_VENV/bin/activate
319           while read var; do
320               declare -x "\${var}" 2>/dev/null
321               echo $var
322           done < ${XCI_PATH}/.cache/xci.env && cd ${XCI_PATH}/xci && \
323           ansible-playbook -i playbooks/dynamic_inventory.py playbooks/prepare-tests.yml
324           ssh root@192.168.122.2 "/root/prepare-tests.sh"
325           echo "---------------------------------------------------------------------------------"
326
327 - builder:
328     name: 'xci-daily-functest-macro'
329     builders:
330       - shell: |
331           #!/bin/bash
332           set -o errexit
333           set -o pipefail
334
335           ssh root@192.168.122.2 "/root/run-functest.sh"