Add support for offline package and test for onap release job
[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-full-nofeature'
30       - 'guilin':
31           branch: '{stream}'
32           k8s-version: '1.15'
33           deploy-scenario: 'onap-full-nofeature'
34       - 'frankfurt':
35           branch: '{stream}'
36           k8s-version: '1.15'
37           deploy-scenario: 'onap-sdc-nofeature'
38       - 'elalto':
39           branch: '{stream}'
40           k8s-version: '1.15'
41           deploy-scenario: 'onap-sdc-nofeature'
42
43     environment-type:
44       - offline:
45           disabled: false
46           execution-mode: offline-deployment
47
48     phase:
49       - deploy
50       - test
51
52
53     type:
54       - cloud:
55           provisioner-type: 'heat'
56           slave-type: 'jumphost'
57           gated-projects: 'infra/stack/onap|infra/installer/oom'
58           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"
59           idf: "https://gerrit.nordix.org/gitweb?p=infra/provisioner/heat.git;a=blob_plain;f=playbooks/roles/create-stack/files/heat-idf.yaml"
60
61     distro:
62       - ubuntu1804
63
64     cloud:
65       - city:
66           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
67     jobs:
68       - 'onap-release-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
69       - 'onap-release-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
70       - 'onap-release-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
71       - 'onap-release-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
72       - 'onap-release-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
73
74 - job-template:
75     name: 'onap-release-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
76
77     project-type: multijob
78
79     disabled: '{obj:disabled}'
80
81     concurrent: true
82
83     parameters:
84       - string:
85           name: DEPLOY_SCENARIO
86           default: '{deploy-scenario}'
87           description: 'Scenario to test change with.'
88       - string:
89           name: K8S_VERSION
90           default: '{k8s-version}'
91           description: 'K8S version to use for this deployment'
92       - string:
93           name: INVENTORY_INI
94           default: /tmp/inventory.ini
95           description: 'Location of the inventory file. Copied from k8s install'
96       - string:
97           name: DISTRO
98           default: '{distro}'
99           description: 'Distribution to use for configuring target nodes (networking etc.)'
100       - label:
101           name: SLAVE_LABEL
102           default: 'engine-{slave-type}-{environment-type}-{distro}-fra'
103           description: 'Slave label to schedule this job on.'
104       - string:
105           name: HW_TYPE
106           default: '{type}'
107           description: 'Hardware type - could be virtual, cloud, or baremetal'
108       - string:
109           name: EXECUTION_MODE
110           default: '{execution-mode}'
111           description: 'Execution mode to run in'
112       - string:
113           name: PDF
114           default: '{pdf}'
115           description: 'PDF file to use for deployment'
116       - string:
117           name: IDF
118           default: '{idf}'
119           description: 'IDF file to use for deployment'
120       - string:
121           name: HEAT_STACK_NAME
122           default: "nordix-cicd-verify-onap-{environment-type}-{distro}-{stream}"
123           description: 'Name of the created stack'
124       - string:
125           name: KEYPAIR_NAME
126           default: "keypair-nordix-cicd-verify-onap-{environment-type}-{distro}-{stream}"
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: DELETE_STACK
134           default: 'false'
135           description: 'Delete the stack upon completion of the build'
136       - string:
137           name: VERBOSITY
138           default: 'true'
139           description: 'Verbosity setting for the engine - true or false - default is false'
140       - string:
141           name: CI_LOOP
142           default: "verify"
143           description: 'CI loop the job belongs to'
144       - project-parameters:
145           project: $GERRIT_PROJECT
146           branch: '{branch}'
147           description: 'The project and branch which the change is proposed for'
148       - nordix-gerrit-parameters
149
150     properties:
151       - logrotate
152       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
153       - throttle:
154           enabled: true
155           max-per-node: 1
156           max-total: 8
157           option: category
158           categories:
159             - engine-verify-deploy-test
160
161     scm:
162       - git:
163           url: https://gerrit.nordix.org/infra/engine.git
164           branches:
165             - master
166           timeout: 15
167           wipe-workspace: true
168     wrappers:
169       - build-timeout:
170           timeout: 600
171       - credentials-binding:
172           - file:
173               credential-id: '{openrc-credentials-file}'
174               variable: OPENRC_FILE
175           - username-password-separated:
176               credential-id: 'nordix-cicd-arm-credentials'
177               username: NORDIX_ARM_USERNAME
178               password: NORDIX_ARM_TOKEN
179       - mask-passwords
180       - openstack:
181           single-use: True
182       - pre-scm-buildstep:
183           failOnError: true
184           buildsteps:
185             - shell: |
186                 #!/bin/bash
187                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
188                 # offline nodes can not resolve Nordix Artifactory and Gerrit
189                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
190                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
191                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
192                   sudo bash -c "cat << EOF >> /etc/hosts
193                 # managed by engine
194                 91.106.198.25 artifactory.nordix.org
195                 91.106.198.142 gerrit.nordix.org
196                 86.107.242.50 fra1.citycloud.com
197                 # managed by engine
198                 EOF"
199                   # we need to get rid of search domain as well
200                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
201                 fi
202
203     builders:
204       - 'generate-k8sdeployment-environment-macro'
205       - multijob:
206           name: "{environment-type} deployment on {type} instances"
207           condition: SUCCESSFUL
208           execution-type: SEQUENTIALLY
209           projects:
210             - name: 'onap-release-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
211               current-parameters: true
212               git-revision: true
213               node-parameters: true
214               kill-phase-on: FAILURE
215               abort-all-job: false
216               property-file: $WORKSPACE/k8s.properties
217             - name: 'onap-release-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
218               current-parameters: true
219               git-revision: true
220               node-parameters: true
221               kill-phase-on: FAILURE
222               abort-all-job: false
223       - multijob:
224           name: xTesting for infra-healthcheck and healthcheck
225           condition: ALWAYS
226           projects:
227             - name: 'onap-release-{environment-type}-xtesting-infra-healthcheck-{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             - name: 'onap-release-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
234               current-parameters: true
235               git-revision: true
236               node-parameters: true
237               kill-phase-on: FAILURE
238               abort-all-job: false
239     publishers:
240       - postbuildscript:
241           builders:
242             - role: SLAVE
243               build-on:
244                 - SUCCESS
245                 - FAILURE
246                 - ABORTED
247                 - NOT_BUILT
248                 - UNSTABLE
249               build-steps:
250                 - 'wait-pkg-mgr-macro'
251                 - 'delete-stack-macro'
252
253 - job-template:
254     name: 'onap-release-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
255
256     disabled: '{obj:disabled}'
257
258     concurrent: true
259
260     properties:
261       - logrotate
262       - throttle:
263           max-per-node: 1
264           max-total: 3
265           option: project
266
267     wrappers:
268       - build-timeout:
269           timeout: 600
270       - credentials-binding:
271           - file:
272               credential-id: '{openrc-credentials-file}'
273               variable: OPENRC_FILE
274           - username-password-separated:
275               credential-id: 'nordix-cicd-arm-credentials'
276               username: NORDIX_ARM_USERNAME
277               password: NORDIX_ARM_TOKEN
278       - mask-passwords
279       - fix-workspace-permissions
280
281     builders:
282       - 'generate-ssh-keypair-macro'
283       - 'wait-pkg-mgr-macro'
284       - 'download-deploy-artifact-macro'
285       - 'deploy-macro'
286
287 - job-template:
288     name: 'onap-release-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
289
290     disabled: '{obj:disabled}'
291
292     concurrent: true
293
294     properties:
295       - logrotate
296       - throttle:
297           max-per-node: 1
298           max-total: 3
299           option: project
300     wrappers:
301       - build-timeout:
302           timeout: 600
303       - credentials-binding:
304           - file:
305               credential-id: '{openrc-credentials-file}'
306               variable: OPENRC_FILE
307           - username-password-separated:
308               credential-id: 'nordix-cicd-arm-credentials'
309               username: NORDIX_ARM_USERNAME
310               password: NORDIX_ARM_TOKEN
311       - mask-passwords
312       - fix-workspace-permissions
313
314     builders:
315       - 'generate-ssh-keypair-macro'
316       - 'wait-pkg-mgr-macro'
317       - 'download-deploy-artifact-macro'
318       - 'deploy-macro'
319
320 - job-template:
321     name: 'onap-release-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
322
323     disabled: '{obj:disabled}'
324
325     parameters:
326       - string:
327           name: EXECUTION_MODE
328           default: 'offline-test'
329           description: 'Execution mode'
330       - string:
331           name: TEST_REPO_URL
332           default: 'https://gerrit.nordix.org/infra/test.git'
333           description: 'URL to clone the test repo from'
334       - string:
335           name: TEST_FW
336           default: 'xtesting'
337           description: 'Test framework to use'
338       - string:
339           name: TEST_SUITE
340           default: 'infra-healthcheck'
341           description: 'Test suite to run'
342
343
344     properties:
345       - logrotate
346       - throttle:
347           max-per-node: 1
348           max-total: 3
349           option: project
350     wrappers:
351       - build-timeout:
352           timeout: 600
353       - mask-passwords
354       - fix-workspace-permissions
355
356     builders:
357       - 'generate-ssh-keypair-macro'
358       - 'wait-pkg-mgr-macro'
359       - 'download-xtesting-artifact-macro'
360       - 'xtesting-infra-healthcheck-macro'
361
362 - job-template:
363     name: 'onap-release-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
364
365     disabled: '{obj:disabled}'
366
367     parameters:
368       - string:
369           name: EXECUTION_MODE
370           default: 'offline-test'
371           description: 'Execution mode'
372       - string:
373           name: TEST_REPO_URL
374           default: 'https://gerrit.nordix.org/infra/test.git'
375           description: 'URL to clone the test repo from'
376       - string:
377           name: TEST_FW
378           default: 'xtesting'
379           description: 'Test framework to use'
380       - string:
381           name: TEST_SUITE
382           default: 'healthcheck'
383           description: 'Test suite to run'
384
385     properties:
386       - logrotate
387       - throttle:
388           max-per-node: 1
389           max-total: 3
390           option: project
391     wrappers:
392       - build-timeout:
393           timeout: 600
394       - mask-passwords
395       - fix-workspace-permissions
396
397     builders:
398       - 'xtesting-healthcheck-macro'