66cbb834f70b6812be316f92de03822dd3897904
[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           blocking-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           all-nodes: false
142           node-eligibility: 'ignore-offline'
143       - string:
144           name: XCI_DISTRO
145           default: '{distro}'
146       - string:
147           name: FUNCTEST_VERSION
148           default: 'hunter'
149       - string:
150           name: FUNCTEST_MODE
151           default: 'tier'
152       - string:
153           name: FUNCTEST_SUITE_NAME
154           default: 'smoke'
155       - string:
156           name: CI_LOOP
157           default: 'daily'
158       - string:
159           name: GIT_BASE
160           default: https://gerrit.opnfv.org/gerrit/$PROJECT
161           description: 'Git URL to use on this Jenkins Slave'
162
163     wrappers:
164       - ssh-agent-wrapper
165       - build-timeout:
166           timeout: 240
167       - fix-workspace-permissions
168
169     builders:
170       - description-setter:
171           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
172       - trigger-builds:
173           - project: 'xci-deploy-{pod}-{distro}-daily-{stream}'
174             current-parameters: false
175             predefined-parameters: |
176               DEPLOY_SCENARIO=$DEPLOY_SCENARIO
177               INSTALLER_TYPE=$INSTALLER_TYPE
178               XCI_FLAVOR=$XCI_FLAVOR
179               CI_LOOP=$CI_LOOP
180               XCI_DISTRO=$XCI_DISTRO
181               FUNCTEST_VERSION=$FUNCTEST_VERSION
182               FUNCTEST_MODE=$FUNCTEST_MODE
183               FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
184             same-node: true
185             block: true
186       - trigger-builds:
187           - project: 'xci-functest-{pod}-{distro}-daily-{stream}'
188             current-parameters: false
189             predefined-parameters: |
190               DEPLOY_SCENARIO=$DEPLOY_SCENARIO
191               INSTALLER_TYPE=$INSTALLER_TYPE
192               XCI_FLAVOR=$XCI_FLAVOR
193               CI_LOOP=$CI_LOOP
194               XCI_DISTRO=$XCI_DISTRO
195               FUNCTEST_VERSION=$FUNCTEST_VERSION
196               FUNCTEST_MODE=$FUNCTEST_MODE
197               FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
198             same-node: true
199             block: true
200             block-thresholds:
201               build-step-failure-threshold: 'never'
202               failure-threshold: 'never'
203               unstable-threshold: 'FAILURE'
204       - trigger-builds:
205           - project: 'xci-yardstick-{pod}-{distro}-daily-{stream}'
206             current-parameters: false
207             predefined-parameters: |
208               DEPLOY_SCENARIO=$DEPLOY_SCENARIO
209               INSTALLER_TYPE=$INSTALLER_TYPE
210               XCI_FLAVOR=$XCI_FLAVOR
211               CI_LOOP=$CI_LOOP
212               XCI_DISTRO=$XCI_DISTRO
213             same-node: true
214             block: true
215             block-thresholds:
216               build-step-failure-threshold: 'never'
217               failure-threshold: 'never'
218               unstable-threshold: 'FAILURE'
219
220     publishers:
221       # yamllint disable rule:line-length
222       # yamllint enable rule:line-length
223       - email-jenkins-admins-on-failure
224
225 - job-template:
226     name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
227
228     disabled: false
229
230     concurrent: true
231
232     properties:
233       - build-blocker:
234           use-build-blocker: true
235           blocking-jobs:
236             - '^xci-verify.*'
237             - '^xci-merge.*'
238             - '^xci-deploy.*'
239             - '^xci-functest.*'
240             - '^bifrost-.*periodic.*'
241             - '^osa-.*periodic.*'
242           blocking-level: 'NODE'
243       - throttle:
244           enabled: true
245           max-per-node: 1
246           option: 'project'
247       - logrotate-default
248
249     wrappers:
250       - ssh-agent-wrapper
251       - build-timeout:
252           timeout: 240
253       - fix-workspace-permissions
254
255     scm:
256       - git-scm
257
258     parameters:
259       - project-parameter:
260           project: '{project}'
261           branch: '{opnfv-releng-version}'
262       - string:
263           name: DEPLOY_SCENARIO
264           default: 'os-nosdn-nofeature-noha'
265       - string:
266           name: INSTALLER_TYPE
267           default: 'osa'
268       - string:
269           name: XCI_FLAVOR
270           default: 'mini'
271       - string:
272           name: XCI_DISTRO
273           default: 'ubuntu'
274       - label:
275           name: SLAVE_LABEL
276           default: '{slave-label}'
277           all-nodes: false
278           node-eligibility: 'ignore-offline'
279       - string:
280           name: FUNCTEST_VERSION
281           default: 'hunter'
282       - string:
283           name: FUNCTEST_MODE
284           default: 'tier'
285       - string:
286           name: FUNCTEST_SUITE_NAME
287           default: 'smoke'
288       - string:
289           name: CI_LOOP
290           default: 'daily'
291       - string:
292           name: GIT_BASE
293           default: https://gerrit.opnfv.org/gerrit/$PROJECT
294
295     builders:
296       - description-setter:
297           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
298       - 'xci-daily-{phase}-macro'
299
300 # --------------------------
301 # builder macros
302 # --------------------------
303 # These need to be properly fixed once the basic deployment, functest, and
304 # yardstick jobs are working outside of clean vm.
305 # One of the ugly fixes is moving test  preparation step into the
306 # deployment job itself since test preparation requires some of the
307 # things from deployment job. With clean VM, this wasn't an issue
308 # since everything was on clean VM. When we move things out of clean
309 # VM, things are done in workspaces of the jobs that are different.
310 #
311 # Apart from these things, we will need to go through the scripts
312 # used for verify jobs and make them updated in order to be able to
313 # use them for jobs that don't use clean VM.
314 - builder:
315     name: 'xci-daily-deploy-macro'
316     builders:
317       - shell: |
318           #!/bin/bash
319           set -o errexit
320           set -o pipefail
321
322           echo "Cleaning the leftovers from the earlier run"
323           echo "---------------------------------------------------------------------------------"
324           for vm in $(sudo virsh list --all --name | grep -v xci_vm); do
325               echo "Removing $vm"
326               sudo virsh destroy $vm > /dev/null 2>&1 || true
327               sudo virsh undefine $vm > /dev/null 2>&1 || true
328               sudo killall -r vbmc > /dev/null 2>&1 || true
329               sudo rm -rf /root/.vbmc > /dev/null 2>&1 || true
330           done
331           echo "---------------------------------------------------------------------------------"
332
333           cd $WORKSPACE/xci && ./xci-deploy.sh
334
335           echo "Prepare OPNFV VM for Tests"
336           echo "---------------------------------------------------------------------------------"
337           export XCI_PATH=$WORKSPACE
338           export XCI_VENV=${XCI_PATH}/venv
339           source $XCI_VENV/bin/activate
340           while read var; do
341               declare -x "\${var}" 2>/dev/null
342               echo $var
343           done < ${XCI_PATH}/.cache/xci.env && cd ${XCI_PATH}/xci && \
344           ansible-playbook -i playbooks/dynamic_inventory.py playbooks/prepare-tests.yml
345           ssh root@192.168.122.2 "/root/prepare-tests.sh"
346           echo "---------------------------------------------------------------------------------"
347
348 - builder:
349     name: 'xci-daily-functest-macro'
350     builders:
351       - shell: |
352           #!/bin/bash
353           set -o pipefail
354
355           ssh root@192.168.122.2 "/root/run-functest.sh"
356           functest_exit=$?
357
358           case ${DEPLOY_SCENARIO[0]} in
359               os-*)
360                   FUNCTEST_LOG=/root/functest-results/functest.log
361                   ;;
362               k8-*)
363                   FUNCTEST_LOG=/root/functest-results/functest-kubernetes.log
364                   ;;
365               *)
366                   echo "Unable to determine the installer. Exiting!"
367                   exit $functest_exit
368                   ;;
369           esac
370
371           echo "Functest log"
372           echo "---------------------------------------------------------------------------------"
373           ssh root@192.168.122.2 "cat $FUNCTEST_LOG"
374           echo "---------------------------------------------------------------------------------"
375           exit ${functest_exit}
376 - builder:
377     name: 'xci-daily-yardstick-macro'
378     builders:
379       - shell: |
380           #!/bin/bash
381           set -o errexit
382           set -o pipefail
383
384           ssh root@192.168.122.2 "/root/run-yardstick.sh"