814cf3fd6841bcd404e639ef609b13a732c44cce
[infra/cicd.git] / jjb / cloud-infra / onap-jobs / onap-release-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-release-deploy-test'
22
23     project: 'onap-release-deploy-test'
24
25     stream:
26       - 'master':
27           branch: '{stream}'
28           k8s-version: '1.15'
29           deploy-scenario: 'onap-sdc-nofeature'
30       - 'frankfurt':
31           branch: '{stream}'
32           k8s-version: '1.15'
33           deploy-scenario: 'onap-sdc-nofeature'
34       - 'elalto':
35           branch: '{stream}'
36           k8s-version: '1.15'
37           deploy-scenario: 'onap-sdc-nofeature'
38
39     environment-type:
40       - offline:
41           disabled: false
42           execution-mode: offline-deployment
43     # just deploy phase for now and ONAP testing isn't defined yet
44     phase:
45       - deploy
46
47
48     type:
49       - cloud:
50           provisioner-type: 'heat'
51           slave-type: 'jumphost'
52           gated-projects: 'infra/stack/onap|infra/installer/oom'
53           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-onap.yaml"
54           idf: "https://gerrit.nordix.org/gitweb?p=infra/provisioner/heat.git;a=blob_plain;f=playbooks/roles/create-stack/files/heat-idf.yaml"
55
56     distro:
57       - ubuntu1804
58
59     cloud:
60       - city:
61           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
62     jobs:
63       - 'onap-release-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
64       - 'onap-release-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
65       - 'onap-release-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
66
67 - job-template:
68     name: 'onap-release-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
69
70     project-type: multijob
71
72     disabled: '{obj:disabled}'
73
74     concurrent: true
75
76     parameters:
77       - string:
78           name: DEPLOY_SCENARIO
79           default: '{deploy-scenario}'
80           description: 'Scenario to test change with.'
81       - string:
82           name: K8S_VERSION
83           default: '{k8s-version}'
84           description: 'K8S version to use for this deployment'
85       - string:
86           name: INVENTORY_INI
87           default: /tmp/inventory.ini
88           description: 'Location of the inventory file. Copied from k8s install'
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_STACK_NAME
115           default: "nordix-cicd-verify-onap-{environment-type}-{distro}-{stream}"
116           description: 'Name of the created stack'
117       - string:
118           name: KEYPAIR_NAME
119           default: "keypair-nordix-cicd-verify-onap-{environment-type}-{distro}-{stream}"
120           description: 'Name of the created keypair'
121       - string:
122           name: USE_PREBUILT_DEPLOYMENT_IMAGE
123           default: 'true'
124           description: 'Use prebuilt deployment image while running as part of CI/CD'
125       - string:
126           name: TEST_REPO_URL
127           default: 'https://gerrit.nordix.org/infra/test.git'
128           description: 'URL to clone the test repo from'
129       - string:
130           name: TEST_FW
131           default: 'functest'
132           description: 'Test framework to use'
133       - string:
134           name: TEST_SUITE
135           default: 'healthcheck'
136           description: 'Test suite to run'
137       - string:
138           name: YARDSTICK_DISPATCHER
139           default: 'file'
140           description: 'Dispatcher to use for Yardstick reporting'
141       - string:
142           name: DELETE_STACK
143           default: 'false'
144           description: 'Delete the stack upon completion of the build'
145       - string:
146           name: VERBOSITY
147           default: 'true'
148           description: 'Verbosity setting for the engine - true or false - default is false'
149       - string:
150           name: CI_LOOP
151           default: "verify"
152           description: 'CI loop the job belongs to'
153       - project-parameters:
154           project: $GERRIT_PROJECT
155           branch: '{branch}'
156           description: 'The project and branch which the change is proposed for'
157       - nordix-gerrit-parameters
158
159     properties:
160       - logrotate
161       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
162       - throttle:
163           enabled: true
164           max-per-node: 1
165           max-total: 8
166           option: category
167           categories:
168             - engine-verify-deploy-test
169
170     scm:
171       - git:
172           url: https://gerrit.nordix.org/infra/engine.git
173           branches:
174             - master
175           timeout: 15
176           wipe-workspace: true
177     wrappers:
178       - build-timeout:
179           timeout: 300
180       - credentials-binding:
181           - file:
182               credential-id: '{openrc-credentials-file}'
183               variable: OPENRC_FILE
184           - username-password-separated:
185               credential-id: 'nordix-cicd-arm-credentials'
186               username: NORDIX_ARM_USERNAME
187               password: NORDIX_ARM_TOKEN
188       - mask-passwords
189       - openstack:
190           single-use: True
191       - pre-scm-buildstep:
192           failOnError: true
193           buildsteps:
194             - shell: |
195                 #!/bin/bash
196                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
197                 # offline nodes can not resolve Nordix Artifactory and Gerrit
198                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
199                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
200                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
201                   sudo bash -c "cat << EOF >> /etc/hosts
202                 # managed by engine
203                 91.106.198.25 artifactory.nordix.org
204                 91.106.198.142 gerrit.nordix.org
205                 86.107.242.50 fra1.citycloud.com
206                 # managed by engine
207                 EOF"
208                   # we need to get rid of search domain as well
209                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
210                 fi
211
212     builders:
213       - 'generate-release-metadata-macro'
214       - 'generate-k8sdeployment-environment-macro'
215       - multijob:
216           name: "{environment-type} deployment on {type} instances"
217           condition: SUCCESSFUL
218           execution-type: SEQUENTIALLY
219           projects:
220             - name: 'onap-release-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
221               current-parameters: true
222               git-revision: true
223               node-parameters: true
224               kill-phase-on: FAILURE
225               abort-all-job: false
226               property-file: $WORKSPACE/k8s.properties
227             - name: 'onap-release-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
228               current-parameters: true
229               git-revision: true
230               node-parameters: true
231               kill-phase-on: FAILURE
232               abort-all-job: false
233               property-file: $WORKSPACE/release.properties
234     publishers:
235       - postbuildscript:
236           builders:
237             - role: SLAVE
238               build-on:
239                 - SUCCESS
240                 - FAILURE
241                 - ABORTED
242                 - NOT_BUILT
243                 - UNSTABLE
244               build-steps:
245                 - 'wait-pkg-mgr-macro'
246                 - 'delete-stack-macro'
247
248 - job-template:
249     name: 'onap-release-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
250
251     disabled: '{obj:disabled}'
252
253     concurrent: true
254
255     properties:
256       - logrotate
257       - throttle:
258           max-per-node: 1
259           max-total: 3
260           option: project
261
262     wrappers:
263       - build-timeout:
264           timeout: 300
265       - credentials-binding:
266           - file:
267               credential-id: '{openrc-credentials-file}'
268               variable: OPENRC_FILE
269           - username-password-separated:
270               credential-id: 'nordix-cicd-arm-credentials'
271               username: NORDIX_ARM_USERNAME
272               password: NORDIX_ARM_TOKEN
273       - mask-passwords
274       - fix-workspace-permissions
275
276     builders:
277       - 'generate-ssh-keypair-macro'
278       - 'wait-pkg-mgr-macro'
279       - 'download-deploy-artifact-macro'
280       - 'deploy-macro'
281
282 - job-template:
283     name: 'onap-release-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
284
285     disabled: '{obj:disabled}'
286
287     concurrent: true
288
289     properties:
290       - logrotate
291       - throttle:
292           max-per-node: 1
293           max-total: 3
294           option: project
295     wrappers:
296       - build-timeout:
297           timeout: 300
298       - credentials-binding:
299           - file:
300               credential-id: '{openrc-credentials-file}'
301               variable: OPENRC_FILE
302           - username-password-separated:
303               credential-id: 'nordix-cicd-arm-credentials'
304               username: NORDIX_ARM_USERNAME
305               password: NORDIX_ARM_TOKEN
306       - mask-passwords
307       - fix-workspace-permissions
308
309     builders:
310       - 'generate-ssh-keypair-macro'
311       - 'wait-pkg-mgr-macro'
312       - 'download-deploy-artifact-macro'
313       - 'deploy-macro'