engine: Create openstack release jobs
[infra/cicd.git] / jjb / engine / openstack-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           deploy-scenario: 'os-nosdn-nofeature'
29       - 'train':
30           branch: '{stream}'
31           deploy-scenario: 'os-nosdn-nofeature'
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: DEPLOY_SCENARIO
87           default: '{deploy-scenario}'
88           description: 'Scenario to test change with.'
89       - string:
90           name: DISTRO
91           default: '{distro}'
92           description: 'Distribution to use for configuring target nodes (networking etc.)'
93       - label:
94           name: SLAVE_LABEL
95           default: 'engine-{slave-type}-{environment-type}-{distro}-fra'
96           description: 'Slave label to schedule this job on.'
97       - string:
98           name: HW_TYPE
99           default: '{type}'
100           description: 'Hardware type - could be virtual, cloud, or baremetal'
101       - string:
102           name: EXECUTION_MODE
103           default: '{execution-mode}'
104           description: 'Execution mode to run in'
105       - string:
106           name: PDF
107           default: '{pdf}'
108           description: 'PDF file to use for deployment'
109       - string:
110           name: IDF
111           default: '{idf}'
112           description: 'IDF file to use for deployment'
113       - string:
114           name: HEAT_ENVIRONMENT_FILENAME
115           default: 'heat-environment-{cloud}-{distro}.yaml'
116           description: 'Name of heat-environment file to use.'
117       - string:
118           name: HEAT_STACK_NAME
119           default: "nordix-cicd-verify-openstack-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
120           description: 'Name of the created stack'
121       - string:
122           name: KEYPAIR_NAME
123           default: "keypair-nordix-cicd-verify-openstack-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
124           description: 'Name of the created keypair'
125       - string:
126           name: USE_PREBUILT_DEPLOYMENT_IMAGE
127           default: 'true'
128           description: 'Use prebuilt deployment image while running as part of CI/CD'
129       - string:
130           name: TEST_REPO_URL
131           default: 'https://gerrit.nordix.org/infra/test.git'
132           description: 'URL to clone the test repo from'
133       - string:
134           name: TEST_FW
135           default: 'functest'
136           description: 'Test framework to use'
137       - string:
138           name: TEST_SUITE
139           default: 'healthcheck'
140           description: 'Test suite to run'
141       - string:
142           name: YARDSTICK_DISPATCHER
143           default: 'file'
144           description: 'Dispatcher to use for Yardstick reporting'
145       - string:
146           name: DELETE_STACK
147           default: 'true'
148           description: 'Delete the stack upon completion of the build'
149       - string:
150           name: VERBOSITY
151           default: 'true'
152           description: 'Verbosity setting for the engine - true or false - default is false'
153       - string:
154           name: CI_LOOP
155           default: "verify"
156           description: 'CI loop the job belongs to'
157       - project-parameters:
158           project: $GERRIT_PROJECT
159           branch: '{branch}'
160           description: 'The project and branch which the change is proposed for'
161       - nordix-gerrit-parameters
162
163     properties:
164       - logrotate
165       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
166       - throttle:
167           enabled: true
168           max-per-node: 1
169           max-total: 8
170           option: category
171           categories:
172             - engine-verify-deploy-test
173
174     scm:
175       - git-scm-gerrit:
176           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
177           branch: $GERRIT_BRANCH
178           refspec: $GERRIT_REFSPEC
179           wipe_workspace: true
180           clean_before: false
181
182     triggers:
183       - gerrit:
184           server-name: 'Nordix Gerrit'
185           trigger-on:
186             - patchset-created-event:
187                 exclude-drafts: 'false'
188                 exclude-trivial-rebase: 'false'
189                 exclude-no-code-change: 'false'
190             - draft-published-event
191             - comment-added-contains-event:
192                 comment-contains-value: 'recheck'
193             - comment-added-contains-event:
194                 comment-contains-value: 'reverify'
195           projects:
196             - project-compare-type: 'REG_EXP'
197               project-pattern: '{gated-projects}'
198               branches:
199                 - branch-compare-type: 'ANT'
200                   branch-pattern: '**/{branch}'
201               disable-strict-forbidden-file-verification: 'true'
202               forbidden-file-paths:
203                 - compare-type: ANT
204                   pattern: 'docs/**|releasenotes/**'
205           skip-vote:
206             successful: '{obj:successful}'
207             failed: '{obj:failed}'
208             unstable: '{obj:unstable}'
209             notbuilt: '{obj:notbuilt}'
210           custom-url: '* $JOB_NAME $BUILD_URL'
211           readable-message: 'true'
212           dependency-jobs: '{dependency-jobs}'
213
214     wrappers:
215       - build-timeout:
216           timeout: 180
217       - credentials-binding:
218           - file:
219               credential-id: '{openrc-credentials-file}'
220               variable: OPENRC_FILE
221           - username-password-separated:
222               credential-id: 'nordix-cicd-arm-credentials'
223               username: NORDIX_ARM_USERNAME
224               password: NORDIX_ARM_TOKEN
225       - mask-passwords
226       - openstack:
227           single-use: True
228       - pre-scm-buildstep:
229           failOnError: true
230           buildsteps:
231             - system-groovy:
232                 command: |
233                   def build = this.getProperty('binding').getVariable('build')
234                   def listener = this.getProperty('binding').getVariable('listener')
235                   if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
236                     println "WARN  : Aborting build since dependent job did not succeed!"
237                     throw new InterruptedException()
238                   }}
239             - shell: |
240                 #!/bin/bash
241                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
242                 # offline nodes can not resolve Nordix Artifactory and Gerrit
243                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
244                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
245                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
246                   sudo bash -c "cat << EOF >> /etc/hosts
247                 # managed by engine
248                 91.106.198.25 artifactory.nordix.org
249                 91.106.198.142 gerrit.nordix.org
250                 86.107.242.50 fra1.citycloud.com
251                 # managed by engine
252                 EOF"
253                   # we need to get rid of search domain as well
254                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
255                 fi
256
257     builders:
258       - 'generate-change-metadata-macro'
259       - multijob:
260           name: "{environment-type} deployment on {type} instances"
261           condition: SUCCESSFUL
262           execution-type: PARALLEL
263           projects:
264             - name: 'openstack-verify-{environment-type}-deploy-{distro}-city-{type}-{stream}'
265               current-parameters: true
266               git-revision: true
267               node-parameters: true
268               kill-phase-on: FAILURE
269               abort-all-job: false
270               property-file: $WORKSPACE/change.properties
271       - multijob:
272           name: "{environment-type} testing on {type} instances"
273           condition: SUCCESSFUL
274           execution-type: PARALLEL
275           projects:
276             - name: 'openstack-verify-{environment-type}-functest-{distro}-city-{type}-{stream}'
277               current-parameters: true
278               git-revision: false
279               node-parameters: true
280               kill-phase-on: FAILURE
281               abort-all-job: false
282               property-file: $WORKSPACE/change.properties
283
284     publishers:
285       - postbuildscript:
286           builders:
287             - role: SLAVE
288               build-on:
289                 - SUCCESS
290                 - FAILURE
291                 - ABORTED
292                 - NOT_BUILT
293                 - UNSTABLE
294               build-steps:
295                 - 'wait-pkg-mgr-macro'
296                 - 'delete-stack-macro'
297
298 - job-template:
299     name: 'openstack-verify-{environment-type}-{phase}-{distro}-{cloud}-{type}-{stream}'
300
301     disabled: '{obj:disabled}'
302
303     concurrent: true
304
305     properties:
306       - logrotate
307       - throttle:
308           max-per-node: 1
309           max-total: 3
310           option: project
311
312     scm:
313       - git-scm-gerrit:
314           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
315           branch: $GERRIT_BRANCH
316           refspec: $GERRIT_REFSPEC
317           wipe_workspace: true
318           clean_before: false
319
320     wrappers:
321       - build-timeout:
322           timeout: 180
323       - credentials-binding:
324           - file:
325               credential-id: '{openrc-credentials-file}'
326               variable: OPENRC_FILE
327           - username-password-separated:
328               credential-id: 'nordix-cicd-arm-credentials'
329               username: NORDIX_ARM_USERNAME
330               password: NORDIX_ARM_TOKEN
331       - mask-passwords
332       - fix-workspace-permissions
333
334     builders:
335       - 'generate-ssh-keypair-macro'
336       - 'wait-pkg-mgr-macro'
337       - 'download-artifact-macro'
338       - '{phase}-macro'