engine: Enable testing of online deployments
[infra/cicd.git] / jjb / engine / engine-verify-jobs / engine-verify-offline-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-offline-deploy-test'
22
23     project: 'engine-verify-offline-deploy-test'
24
25     stream:
26       - 'master':
27           branch: '{stream}'
28
29     phase:
30       - deploy
31       - test
32
33     type:
34       - virtual:
35           provisioner-type: 'bifrost'
36           slave-type: 'vpod'
37       - cloud:
38           provisioner-type: 'heat'
39           slave-type: 'jumphost'
40
41     distro:
42       - ubuntu1804
43
44     cloud:
45       - city:
46           openrc-credentials-file: 'est-jenkins-openrcfile-city-karlskrona-onap'
47
48     jobs:
49       - 'engine-verify-offline-deploy-test-{distro}-{cloud}-{type}-{stream}'
50       - 'engine-verify-offline-{phase}-{distro}-{cloud}-{type}-{stream}'
51
52 - job-template:
53     name: 'engine-verify-offline-deploy-test-{distro}-{cloud}-{type}-{stream}'
54
55     project-type: multijob
56
57     disabled: '{obj:disabled}'
58
59     concurrent: true
60
61     parameters:
62       - project-parameters:
63           project: $GERRIT_PROJECT
64           branch: '{branch}'
65           description: 'The project and branch which the change is proposed for'
66       - label:
67           name: SLAVE_LABEL
68           default: 'engine-{slave-type}-offline-{distro}'
69           description: 'Slave label to schedule this job on.'
70       - string:
71           name: PROVISIONER_TYPE
72           default: '{provisioner-type}'
73           description: 'Provisioner type to use'
74       - string:
75           name: HEAT_ENVIRONMENT_FILENAME
76           default: 'heat-environment-{cloud}-{distro}.yaml'
77           description: 'Name of heat-environment file to use.'
78       - string:
79           name: STACK_NAME
80           default: "nordix-cicd-verify-engine-offline-{distro}-$BUILD_NUMBER"
81           description: 'Name of the created stack'
82       - string:
83           name: KEYPAIR_NAME
84           default: "keypair-nordix-cicd-verify-offline-engine-{distro}-$BUILD_NUMBER"
85           description: 'Name of the created keypair'
86       - string:
87           name: USE_PREBUILT_DEPLOYMENT_IMAGE
88           default: 'true'
89           description: 'Use prebuilt deployment image while running as part of CI/CD'
90       - string:
91           name: TEST_REPO_URL
92           default: 'https://gerrit.nordix.org/infra/test.git'
93           description: 'URL to clone the test repo from'
94       - string:
95           name: TEST_FW
96           default: 'functest'
97           description: 'Test framework to use'
98       - string:
99           name: TEST_SUITE
100           default: 'healthcheck'
101           description: 'Test suite to run'
102       - string:
103           name: DELETE_STACK
104           default: 'true'
105           description: 'Delete the stack upon completion of the build'
106
107     properties:
108       - logrotate
109       - throttle:
110           max-per-node: 1
111           max-total: 3
112           option: project
113
114     wrappers:
115       - build-timeout:
116           timeout: 180
117       - credentials-binding:
118           - file:
119               credential-id: '{openrc-credentials-file}'
120               variable: OPENRC_FILE
121           - username-password-separated:
122               credential-id: 'nordix-cicd-arm-credentials'
123               username: NORDIX_ARM_USERNAME
124               password: NORDIX_ARM_TOKEN
125       - mask-passwords
126       - fix-workspace-permissions
127       - openstack:
128           single-use: True
129
130     builders:
131       - 'engine-wait-pkg-mgr-macro'
132       - shell: |
133           #!/bin/bash
134           sudo sed -i 's/^search/# search/' /etc/resolv.conf
135       - 'engine-generate-ssh-keypair-macro'
136       - 'engine-download-artifact-macro'
137       - multijob:
138           name: "Offline Deployment on {type} instances"
139           condition: SUCCESSFUL
140           execution-type: PARALLEL
141           projects:
142             - name: 'engine-verify-offline-deploy-{distro}-city-{type}-master'
143               current-parameters: true
144               node-parameters: true
145               kill-phase-on: FAILURE
146               abort-all-job: false
147       - multijob:
148           name: "Offline Testing on {type} instances"
149           condition: SUCCESSFUL
150           execution-type: PARALLEL
151           projects:
152             - name: 'engine-verify-offline-test-{distro}-city-{type}-master'
153               current-parameters: true
154               node-parameters: true
155               kill-phase-on: FAILURE
156               abort-all-job: false
157       - conditional-step:
158           condition-kind: and
159           condition-operands:
160             - condition-kind: strings-match
161               condition-string1: $DELETE_STACK
162               condition-string2: true
163             - condition-kind: strings-match
164               condition-string1: $PROVISIONER_TYPE
165               condition-string2: heat
166           on-evaluation-failure: dont-run
167           steps:
168             - 'engine-delete-stack-macro'
169
170 - job-template:
171     name: 'engine-verify-offline-{phase}-{distro}-{cloud}-{type}-{stream}'
172
173     disabled: '{obj:disabled}'
174
175     concurrent: true
176
177     properties:
178       - logrotate
179       - throttle:
180           max-per-node: 1
181           max-total: 3
182           option: project
183
184     wrappers:
185       - build-timeout:
186           timeout: 180
187       - credentials-binding:
188           - file:
189               credential-id: '{openrc-credentials-file}'
190               variable: OPENRC_FILE
191           - username-password-separated:
192               credential-id: 'nordix-cicd-arm-credentials'
193               username: NORDIX_ARM_USERNAME
194               password: NORDIX_ARM_TOKEN
195       - mask-passwords
196       - fix-workspace-permissions
197
198     builders:
199       - 'engine-{phase}-macro'