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