5f1e13433dd08d6a207d1d1c925d86a8d954dfef
[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-os.*'
81             - '^xci-deploy.*'
82             - '^xci-functest.*'
83             - '^bifrost-.*periodic.*'
84             - '^osa-.*periodic.*'
85           block-level: 'NODE'
86       - logrotate-default
87
88     parameters:
89       - string:
90           name: DEPLOY_SCENARIO
91           default: '{deploy-scenario}'
92       - string:
93           name: INSTALLER_TYPE
94           default: '{installer-type}'
95       - string:
96           name: XCI_FLAVOR
97           default: '{xci-flavor}'
98       - label:
99           name: SLAVE_LABEL
100           default: '{slave-label}'
101       - label:
102           name: XCI_DISTRO
103           default: '{distro}'
104       - string:
105           name: FUNCTEST_MODE
106           default: 'tier'
107       - string:
108           name: FUNCTEST_SUITE_NAME
109           default: 'healthcheck'
110       - string:
111           name: CI_LOOP
112           default: 'daily'
113       - string:
114           name: GIT_BASE
115           default: https://gerrit.opnfv.org/gerrit/$PROJECT
116           description: 'Git URL to use on this Jenkins Slave'
117
118     triggers:
119       - '{auto-trigger-name}'
120
121     wrappers:
122       - fix-workspace-permissions
123
124     builders:
125       - description-setter:
126           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
127       - trigger-builds:
128           - project: 'xci-deploy-{pod}-{distro}-daily-{stream}'
129             current-parameters: false
130             predefined-parameters: |
131               DEPLOY_SCENARIO=$DEPLOY_SCENARIO
132               INSTALLER_TYPE=$INSTALLER_TYPE
133               XCI_FLAVOR=$XCI_FLAVOR
134               CI_LOOP=$CI_LOOP
135               XCI_DISTRO=$DISTRO
136             same-node: true
137             block: true
138       - trigger-builds:
139           - project: 'xci-functest-{pod}-{distro}-daily-{stream}'
140             current-parameters: false
141             predefined-parameters: |
142               DEPLOY_SCENARIO=$DEPLOY_SCENARIO
143               INSTALLER_TYPE=$INSTALLER_TYPE
144               XCI_FLAVOR=$XCI_FLAVOR
145               CI_LOOP=$CI_LOOP
146               XCI_DISTRO=$DISTRO
147               FUNCTEST_MODE=$FUNCTEST_MODE
148               FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
149             same-node: true
150             block: true
151             block-thresholds:
152               build-step-failure-threshold: 'never'
153               failure-threshold: 'never'
154               unstable-threshold: 'FAILURE'
155
156     publishers:
157       # yamllint disable rule:line-length
158       # yamllint enable rule:line-length
159       - email-jenkins-admins-on-failure
160       - postbuildscript:
161           builders:
162             - role: BOTH
163               build-on:
164                 - ABORTED
165                 - FAILURE
166                 - NOT_BUILT
167                 - SUCCESS
168                 - UNSTABLE
169               build-steps:
170                 - shell: !include-raw: ./xci-cleanup.sh
171           mark-unstable-if-failed: true
172
173 - job-template:
174     name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
175
176     disabled: false
177
178     concurrent: true
179
180     properties:
181       - build-blocker:
182           use-build-blocker: true
183           blocking-jobs:
184             - '^xci-verify.*'
185             - '^xci-deploy.*'
186             - '^xci-functest.*'
187             - '^bifrost-.*periodic.*'
188             - '^osa-.*periodic.*'
189           block-level: 'NODE'
190       - throttle:
191           enabled: true
192           max-per-node: 1
193           option: 'project'
194       - logrotate-default
195
196     wrappers:
197       - fix-workspace-permissions
198
199     scm:
200       - git-scm
201
202     parameters:
203       - project-parameter:
204           project: '{project}'
205           branch: '{opnfv-releng-version}'
206       - string:
207           name: DEPLOY_SCENARIO
208           default: 'os-nosdn-nofeature-noha'
209       - string:
210           name: INSTALLER_TYPE
211           default: 'osa'
212       - string:
213           name: XCI_FLAVOR
214           default: 'mini'
215       - label:
216           name: XCI_DISTRO
217           default: 'ubuntu'
218       - label:
219           name: SLAVE_LABEL
220           default: '{slave-label}'
221       - string:
222           name: FUNCTEST_MODE
223           default: 'tier'
224       - string:
225           name: FUNCTEST_SUITE_NAME
226           default: 'healthcheck'
227       - string:
228           name: CI_LOOP
229           default: 'daily'
230       - string:
231           name: GIT_BASE
232           default: https://gerrit.opnfv.org/gerrit/$PROJECT
233
234     builders:
235       - description-setter:
236           description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
237       - 'xci-daily-{phase}-macro'
238
239 # --------------------------
240 # builder macros
241 # --------------------------
242 - builder:
243     name: 'xci-daily-deploy-macro'
244     builders:
245       - shell: |
246           #!/bin/bash
247           set -o errexit
248           set -o pipefail
249
250           cd $WORKSPACE/xci && ./xci-deploy.sh
251
252 - builder:
253     name: 'xci-daily-functest-macro'
254     builders:
255       - shell: |
256           #!/bin/bash
257           set -o errexit
258           set -o pipefail
259
260           echo "Prepare OPNFV VM for Functest"
261           echo "---------------------------------------------------------------------------------"
262           export XCI_PATH=$WORKSPACE
263           export XCI_VENV=${XCI_PATH}/venv
264           source $XCI_VENV/bin/activate
265           while read var; do
266               declare -x "\${var}" 2>/dev/null
267               echo $var
268           done < ${XCI_PATH}/.cache/xci.env && cd $XCI_PATH/xci && \
269           ansible-playbook -i playbooks/dynamic_inventory.py playbooks/prepare-functest.yml
270
271           echo "Run Functest"
272           echo "---------------------------------------------------------------------------------"
273           ssh root@192.168.122.2 "/root/run-functest.sh"