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