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