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