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