Merge "Airship: set org members as admin"
[infra/cicd.git] / jjb / engine / verify-jobs / engine-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: 'engine-verify-deploy-test'
22
23     project: 'engine-verify-deploy-test'
24
25     stream:
26       - 'master':
27           branch: '{stream}'
28
29     environment-type:
30       - online:
31           disabled: false
32           execution-mode: online-deployment
33           pdf: 'https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-pdf.yml'
34           idf: 'https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-idf.yml'
35           successful: false
36           failed: false
37           unstable: false
38           notbuilt: false
39       - offline:
40           disabled: false
41           execution-mode: offline-deployment
42           pdf: 'file:///opt/engine/offline/git/hwconfig/pods/nordix-vpod1-pdf.yml'
43           idf: 'file:///opt/engine/offline/git/hwconfig/pods/nordix-vpod1-idf.yml'
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/engine|infra/provisioner/bifrost'
58       - cloud:
59           provisioner-type: 'heat'
60           slave-type: 'jumphost'
61           gated-projects: 'infra/engine|infra/provisioner/heat'
62
63     distro:
64       - ubuntu1804
65
66     cloud:
67       - city:
68           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
69
70     dependency-jobs: 'engine-verify-package-{distro}-{stream}'
71     dependency-job-var: 'TRIGGER_engine_verify_package_{distro}_{stream}_BUILD_RESULT'
72
73     jobs:
74       - 'engine-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
75       - 'engine-verify-{environment-type}-{phase}-{distro}-{cloud}-{type}-{stream}'
76
77 - job-template:
78     name: 'engine-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
79
80     project-type: multijob
81
82     disabled: '{obj:disabled}'
83
84     concurrent: true
85
86     parameters:
87       - label:
88           name: SLAVE_LABEL
89           default: 'engine-{slave-type}-{environment-type}-{distro}-fra'
90           description: 'Slave label to schedule this job on.'
91       - string:
92           name: HW_TYPE
93           default: '{type}'
94           description: 'Hardware type - could be virtual, cloud, or baremetal'
95       - string:
96           name: EXECUTION_MODE
97           default: '{execution-mode}'
98           description: 'Execution mode to run in'
99       - string:
100           name: PDF
101           default: '{pdf}'
102           description: 'PDF file to use for deployment'
103       - string:
104           name: IDF
105           default: '{idf}'
106           description: 'IDF file to use for deployment'
107       - string:
108           name: HEAT_ENVIRONMENT_FILENAME
109           default: 'heat-environment-{cloud}-{distro}.yaml'
110           description: 'Name of heat-environment file to use.'
111       - string:
112           name: HEAT_STACK_NAME
113           default: "nordix-cicd-verify-engine-online-{distro}-$GERRIT_CHANGE_NUMBER"
114           description: 'Name of the created stack'
115       - string:
116           name: KEYPAIR_NAME
117           default: "keypair-nordix-cicd-verify-engine-online-{distro}-$GERRIT_CHANGE_NUMBER"
118           description: 'Name of the created keypair'
119       - string:
120           name: USE_PREBUILT_DEPLOYMENT_IMAGE
121           default: 'true'
122           description: 'Use prebuilt deployment image while running as part of CI/CD'
123       - string:
124           name: TEST_REPO_URL
125           default: 'https://gerrit.nordix.org/infra/test.git'
126           description: 'URL to clone the test repo from'
127       - string:
128           name: TEST_FW
129           default: 'functest'
130           description: 'Test framework to use'
131       - string:
132           name: TEST_SUITE
133           default: 'healthcheck'
134           description: 'Test suite to run'
135       - string:
136           name: YARDSTICK_DISPATCHER
137           default: 'file'
138           description: 'Dispatcher to use for Yardstick reporting'
139       - string:
140           name: DELETE_STACK
141           default: 'true'
142           description: 'Delete the stack upon completion of the build'
143       - string:
144           name: VERBOSITY
145           default: 'true'
146           description: 'Verbosity setting for the engine - true or false - default is false'
147       - string:
148           name: CI_LOOP
149           default: "verify"
150           description: 'CI loop the job belongs to'
151       - project-parameters:
152           project: $GERRIT_PROJECT
153           branch: '{branch}'
154           description: 'The project and branch which the change is proposed for'
155       - nordix-gerrit-parameters
156
157     properties:
158       - logrotate
159       - build-blocker:
160           use-build-blocker: true
161           blocking-jobs:
162             - '.*?-verify-online-deploy-test-.*'
163             - '.*?-verify-offline-deploy-test-.*'
164           block-level: 'NODE'
165       - throttle:
166           max-per-node: 1
167           max-total: 3
168           option: project
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: 'engine-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: 'engine-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: 'engine-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'