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