d492e5786dbe2012cf1f28ffdf1783885ebc053b
[infra/cicd.git] / jjb / engine / verify-jobs / openstack-verify-deploy-test.yaml
1 ---
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019 Nordix Foundation.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 - project:
21     name: 'openstack-verify-deploy-test'
22
23     project: 'openstack-verify-deploy-test'
24
25     stream:
26       - 'master':
27           branch: '{stream}'
28       - 'train':
29           branch: '{stream}'
30       - 'stein':
31           branch: '{stream}'
32
33     environment-type:
34       - online:
35           disabled: false
36           execution-mode: online-deployment
37           successful: false
38           failed: false
39           unstable: false
40           notbuilt: false
41       - offline:
42           disabled: false
43           execution-mode: offline-deployment
44           successful: false
45           failed: false
46           unstable: false
47           notbuilt: false
48
49     phase:
50       - deploy
51       - functest
52
53     type:
54       - virtual:
55           provisioner-type: 'bifrost'
56           slave-type: 'vpod'
57           gated-projects: 'infra/stack/openstack|infra/installer/kolla'
58           pdf: 'https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-pdf.yml'
59           idf: 'https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-idf.yml'
60
61     distro:
62       - ubuntu1804
63
64     cloud:
65       - city:
66           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
67
68     dependency-jobs: 'openstack-verify-package-{distro}-{stream}'
69     dependency-job-var: 'TRIGGER_openstack_verify_package_{distro}_{stream}_BUILD_RESULT'
70
71     jobs:
72       - 'openstack-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
73       - 'openstack-verify-{environment-type}-{phase}-{distro}-{cloud}-{type}-{stream}'
74
75 - job-template:
76     name: 'openstack-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
77
78     project-type: multijob
79
80     disabled: '{obj:disabled}'
81
82     concurrent: true
83
84     parameters:
85       - string:
86           name: DISTRO
87           default: '{distro}'
88           description: 'Distribution to use for configuring target nodes (networking etc.)'
89       - label:
90           name: SLAVE_LABEL
91           default: 'engine-{slave-type}-{environment-type}-{distro}-fra'
92           description: 'Slave label to schedule this job on.'
93       - string:
94           name: HW_TYPE
95           default: '{type}'
96           description: 'Hardware type - could be virtual, cloud, or baremetal'
97       - string:
98           name: EXECUTION_MODE
99           default: '{execution-mode}'
100           description: 'Execution mode to run in'
101       - string:
102           name: PDF
103           default: '{pdf}'
104           description: 'PDF file to use for deployment'
105       - string:
106           name: IDF
107           default: '{idf}'
108           description: 'IDF file to use for deployment'
109       - string:
110           name: HEAT_ENVIRONMENT_FILENAME
111           default: 'heat-environment-{cloud}-{distro}.yaml'
112           description: 'Name of heat-environment file to use.'
113       - string:
114           name: HEAT_STACK_NAME
115           default: "nordix-cicd-verify-openstack-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
116           description: 'Name of the created stack'
117       - string:
118           name: KEYPAIR_NAME
119           default: "keypair-nordix-cicd-verify-openstack-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
120           description: 'Name of the created keypair'
121       - string:
122           name: USE_PREBUILT_DEPLOYMENT_IMAGE
123           default: 'true'
124           description: 'Use prebuilt deployment image while running as part of CI/CD'
125       - string:
126           name: TEST_REPO_URL
127           default: 'https://gerrit.nordix.org/infra/test.git'
128           description: 'URL to clone the test repo from'
129       - string:
130           name: TEST_FW
131           default: 'functest'
132           description: 'Test framework to use'
133       - string:
134           name: TEST_SUITE
135           default: 'healthcheck'
136           description: 'Test suite to run'
137       - string:
138           name: YARDSTICK_DISPATCHER
139           default: 'file'
140           description: 'Dispatcher to use for Yardstick reporting'
141       - string:
142           name: DELETE_STACK
143           default: 'true'
144           description: 'Delete the stack upon completion of the build'
145       - string:
146           name: VERBOSITY
147           default: 'true'
148           description: 'Verbosity setting for the engine - true or false - default is false'
149       - string:
150           name: CI_LOOP
151           default: "verify"
152           description: 'CI loop the job belongs to'
153       - project-parameters:
154           project: $GERRIT_PROJECT
155           branch: '{branch}'
156           description: 'The project and branch which the change is proposed for'
157       - nordix-gerrit-parameters
158
159     properties:
160       - logrotate
161       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
162       - throttle:
163           enabled: true
164           max-per-node: 1
165           max-total: 8
166           option: category
167           categories:
168             - engine-verify-deploy-test
169
170     scm:
171       - git-scm-gerrit:
172           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
173           branch: $GERRIT_BRANCH
174           refspec: $GERRIT_REFSPEC
175           wipe_workspace: true
176           clean_before: false
177
178     triggers:
179       - gerrit:
180           server-name: 'Nordix Gerrit'
181           trigger-on:
182             - patchset-created-event:
183                 exclude-drafts: 'false'
184                 exclude-trivial-rebase: 'false'
185                 exclude-no-code-change: 'false'
186             - draft-published-event
187             - comment-added-contains-event:
188                 comment-contains-value: 'recheck'
189             - comment-added-contains-event:
190                 comment-contains-value: 'reverify'
191           projects:
192             - project-compare-type: 'REG_EXP'
193               project-pattern: '{gated-projects}'
194               branches:
195                 - branch-compare-type: 'ANT'
196                   branch-pattern: '**/{branch}'
197               disable-strict-forbidden-file-verification: 'true'
198               forbidden-file-paths:
199                 - compare-type: ANT
200                   pattern: 'docs/**|releasenotes/**'
201           skip-vote:
202             successful: '{obj:successful}'
203             failed: '{obj:failed}'
204             unstable: '{obj:unstable}'
205             notbuilt: '{obj:notbuilt}'
206           custom-url: '* $JOB_NAME $BUILD_URL'
207           readable-message: 'true'
208           dependency-jobs: '{dependency-jobs}'
209
210     wrappers:
211       - build-timeout:
212           timeout: 180
213       - credentials-binding:
214           - file:
215               credential-id: '{openrc-credentials-file}'
216               variable: OPENRC_FILE
217           - username-password-separated:
218               credential-id: 'nordix-cicd-arm-credentials'
219               username: NORDIX_ARM_USERNAME
220               password: NORDIX_ARM_TOKEN
221       - mask-passwords
222       - openstack:
223           single-use: True
224       - pre-scm-buildstep:
225           failOnError: true
226           buildsteps:
227             - system-groovy:
228                 command: |
229                   def build = this.getProperty('binding').getVariable('build')
230                   def listener = this.getProperty('binding').getVariable('listener')
231                   if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
232                     println "WARN  : Aborting build since dependent job did not succeed!"
233                     throw new InterruptedException()
234                   }}
235             - shell: |
236                 #!/bin/bash
237                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
238                 # offline nodes can not resolve Nordix Artifactory and Gerrit
239                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
240                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
241                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
242                   sudo bash -c "cat << EOF >> /etc/hosts
243                 # managed by engine
244                 91.106.198.25 artifactory.nordix.org
245                 91.106.198.142 gerrit.nordix.org
246                 86.107.242.50 fra1.citycloud.com
247                 # managed by engine
248                 EOF"
249                   # we need to get rid of search domain as well
250                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
251                 fi
252
253     builders:
254       - 'generate-change-metadata-macro'
255       - multijob:
256           name: "{environment-type} deployment on {type} instances"
257           condition: SUCCESSFUL
258           execution-type: PARALLEL
259           projects:
260             - name: 'openstack-verify-{environment-type}-deploy-{distro}-city-{type}-master'
261               current-parameters: true
262               git-revision: true
263               node-parameters: true
264               kill-phase-on: FAILURE
265               abort-all-job: false
266               property-file: $WORKSPACE/change.properties
267       - multijob:
268           name: "{environment-type} testing on {type} instances"
269           condition: SUCCESSFUL
270           execution-type: PARALLEL
271           projects:
272             - name: 'openstack-verify-{environment-type}-functest-{distro}-city-{type}-master'
273               current-parameters: true
274               git-revision: false
275               node-parameters: true
276               kill-phase-on: FAILURE
277               abort-all-job: false
278               property-file: $WORKSPACE/change.properties
279
280     publishers:
281       - postbuildscript:
282           builders:
283             - role: SLAVE
284               build-on:
285                 - SUCCESS
286                 - FAILURE
287                 - ABORTED
288                 - NOT_BUILT
289                 - UNSTABLE
290               build-steps:
291                 - 'wait-pkg-mgr-macro'
292                 - 'delete-stack-macro'
293
294 - job-template:
295     name: 'openstack-verify-{environment-type}-{phase}-{distro}-{cloud}-{type}-{stream}'
296
297     disabled: '{obj:disabled}'
298
299     concurrent: true
300
301     properties:
302       - logrotate
303       - throttle:
304           max-per-node: 1
305           max-total: 3
306           option: project
307
308     scm:
309       - git-scm-gerrit:
310           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
311           branch: $GERRIT_BRANCH
312           refspec: $GERRIT_REFSPEC
313           wipe_workspace: true
314           clean_before: false
315
316     wrappers:
317       - build-timeout:
318           timeout: 180
319       - credentials-binding:
320           - file:
321               credential-id: '{openrc-credentials-file}'
322               variable: OPENRC_FILE
323           - username-password-separated:
324               credential-id: 'nordix-cicd-arm-credentials'
325               username: NORDIX_ARM_USERNAME
326               password: NORDIX_ARM_TOKEN
327       - mask-passwords
328       - fix-workspace-permissions
329
330     builders:
331       - 'generate-ssh-keypair-macro'
332       - 'wait-pkg-mgr-macro'
333       - 'download-artifact-macro'
334       - '{phase}-macro'