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