Add support for ONAP testing in verify jobs
[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           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       - online:
45           disabled: false
46           execution-mode: online-deployment
47           successful: false
48           failed: false
49           unstable: false
50           notbuilt: false
51       - offline:
52           disabled: false
53           execution-mode: offline-deployment
54           successful: false
55           failed: false
56           unstable: false
57           notbuilt: false
58
59     phase:
60       - deploy
61       - test
62
63
64     type:
65       - cloud:
66           provisioner-type: 'heat'
67           slave-type: 'jumphost'
68           gated-projects: 'infra/stack/onap|infra/installer/oom'
69           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"
70           idf: "https://gerrit.nordix.org/gitweb?p=infra/provisioner/heat.git;a=blob_plain;f=playbooks/roles/create-stack/files/heat-idf.yaml"
71
72     distro:
73       - ubuntu1804
74
75     cloud:
76       - city:
77           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
78
79     # This should be
80     dependency-jobs: 'onap-verify-package-{distro}-{stream}'
81     dependency-job-var: 'TRIGGER_onap_verify_package_{distro}_{stream}_BUILD_RESULT'
82
83     jobs:
84       - 'onap-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
85       - 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
86       - 'onap-verify-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
87       - 'onap-verify-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
88       - 'onap-verify-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
89
90
91 - job-template:
92     name: 'onap-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
93
94     project-type: multijob
95
96     disabled: '{obj:disabled}'
97
98     concurrent: true
99
100     parameters:
101       - string:
102           name: DEPLOY_SCENARIO
103           default: '{deploy-scenario}'
104           description: 'Scenario to test change with.'
105       - string:
106           name: K8S_VERSION
107           default: '{k8s-version}'
108           description: 'K8S version to use for this deployment'
109       - string:
110           name: INVENTORY_INI
111           default: /tmp/inventory.ini
112           description: 'Location of the inventory file. Copied from k8s install'
113       - string:
114           name: DISTRO
115           default: '{distro}'
116           description: 'Distribution to use for configuring target nodes (networking etc.)'
117       - label:
118           name: SLAVE_LABEL
119           default: 'engine-{slave-type}-{environment-type}-{distro}-fra'
120           description: 'Slave label to schedule this job on.'
121       - string:
122           name: HW_TYPE
123           default: '{type}'
124           description: 'Hardware type - could be virtual, cloud, or baremetal'
125       - string:
126           name: EXECUTION_MODE
127           default: '{execution-mode}'
128           description: 'Execution mode to run in'
129       - string:
130           name: PDF
131           default: '{pdf}'
132           description: 'PDF file to use for deployment'
133       - string:
134           name: IDF
135           default: '{idf}'
136           description: 'IDF file to use for deployment'
137       - string:
138           name: HEAT_STACK_NAME
139           default: "nordix-cicd-verify-onap-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
140           description: 'Name of the created stack'
141       - string:
142           name: KEYPAIR_NAME
143           default: "keypair-nordix-cicd-verify-onap-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
144           description: 'Name of the created keypair'
145       - string:
146           name: USE_PREBUILT_DEPLOYMENT_IMAGE
147           default: 'true'
148           description: 'Use prebuilt deployment image while running as part of CI/CD'
149       - string:
150           name: DELETE_STACK
151           default: 'false'
152           description: 'Delete the stack upon completion of the build'
153       - string:
154           name: VERBOSITY
155           default: 'true'
156           description: 'Verbosity setting for the engine - true or false - default is false'
157       - string:
158           name: CI_LOOP
159           default: "verify"
160           description: 'CI loop the job belongs to'
161       - project-parameters:
162           project: $GERRIT_PROJECT
163           branch: '{branch}'
164           description: 'The project and branch which the change is proposed for'
165       - nordix-gerrit-parameters
166
167     properties:
168       - logrotate
169       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
170       - throttle:
171           enabled: true
172           max-per-node: 1
173           max-total: 8
174           option: category
175           categories:
176             - engine-verify-deploy-test
177
178     scm:
179       - git-scm-gerrit:
180           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
181           branch: $GERRIT_BRANCH
182           refspec: $GERRIT_REFSPEC
183           wipe_workspace: true
184           clean_before: false
185
186     triggers:
187       - gerrit:
188           server-name: 'Nordix Gerrit'
189           trigger-on:
190             - patchset-created-event:
191                 exclude-drafts: 'false'
192                 exclude-trivial-rebase: 'false'
193                 exclude-no-code-change: 'false'
194             - draft-published-event
195             - comment-added-contains-event:
196                 comment-contains-value: 'recheck'
197             - comment-added-contains-event:
198                 comment-contains-value: 'reverify'
199           projects:
200             - project-compare-type: 'REG_EXP'
201               project-pattern: '{gated-projects}'
202               branches:
203                 - branch-compare-type: 'ANT'
204                   branch-pattern: '**/{branch}'
205               disable-strict-forbidden-file-verification: 'true'
206               forbidden-file-paths:
207                 - compare-type: ANT
208                   pattern: 'docs/**|releasenotes/**'
209           skip-vote:
210             successful: '{obj:successful}'
211             failed: '{obj:failed}'
212             unstable: '{obj:unstable}'
213             notbuilt: '{obj:notbuilt}'
214           custom-url: '* $JOB_NAME $BUILD_URL'
215           readable-message: 'true'
216           dependency-jobs: '{dependency-jobs}'
217
218     wrappers:
219       - build-timeout:
220           timeout: 600
221       - credentials-binding:
222           - file:
223               credential-id: '{openrc-credentials-file}'
224               variable: OPENRC_FILE
225           - username-password-separated:
226               credential-id: 'nordix-cicd-arm-credentials'
227               username: NORDIX_ARM_USERNAME
228               password: NORDIX_ARM_TOKEN
229       - mask-passwords
230       - openstack:
231           single-use: True
232       - pre-scm-buildstep:
233           failOnError: true
234           buildsteps:
235             - system-groovy:
236                 command: |
237                   def build = this.getProperty('binding').getVariable('build')
238                   def listener = this.getProperty('binding').getVariable('listener')
239                   if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
240                     println "WARN  : Aborting build since dependent job did not succeed!"
241                     throw new InterruptedException()
242                   }}
243             - shell: |
244                 #!/bin/bash
245                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
246                 # offline nodes can not resolve Nordix Artifactory and Gerrit
247                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
248                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
249                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
250                   sudo bash -c "cat << EOF >> /etc/hosts
251                 # managed by engine
252                 91.106.198.25 artifactory.nordix.org
253                 91.106.198.142 gerrit.nordix.org
254                 86.107.242.50 fra1.citycloud.com
255                 # managed by engine
256                 EOF"
257                   # we need to get rid of search domain as well
258                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
259                 fi
260
261     builders:
262       - 'generate-change-metadata-macro'
263       - 'generate-k8sdeployment-environment-macro'
264       - multijob:
265           name: "{environment-type} deployment on {type} instances"
266           condition: SUCCESSFUL
267           execution-type: SEQUENTIALLY
268           projects:
269             - name: 'onap-verify-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
270               current-parameters: true
271               git-revision: true
272               node-parameters: true
273               kill-phase-on: FAILURE
274               abort-all-job: false
275               property-file: $WORKSPACE/k8s.properties
276             - name: 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
277               current-parameters: true
278               git-revision: true
279               node-parameters: true
280               kill-phase-on: FAILURE
281               abort-all-job: false
282               property-file: $WORKSPACE/change.properties
283       - multijob:
284           name: xTesting for infra-healthcheck and healthcheck
285           condition: ALWAYS
286           projects:
287             - name: 'onap-verify-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
288               current-parameters: true
289               git-revision: true
290               node-parameters: true
291               kill-phase-on: FAILURE
292               abort-all-job: false
293             - name: 'onap-verify-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
294               current-parameters: true
295               git-revision: true
296               node-parameters: true
297               kill-phase-on: FAILURE
298               abort-all-job: false
299     publishers:
300       - postbuildscript:
301           builders:
302             - role: SLAVE
303               build-on:
304                 - SUCCESS
305                 - FAILURE
306                 - ABORTED
307                 - NOT_BUILT
308                 - UNSTABLE
309               build-steps:
310                 - 'wait-pkg-mgr-macro'
311                 - 'delete-stack-macro'
312
313 - job-template:
314     name: 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
315
316     disabled: '{obj:disabled}'
317
318     concurrent: true
319
320     properties:
321       - logrotate
322       - throttle:
323           max-per-node: 1
324           max-total: 3
325           option: project
326
327     scm:
328       - git-scm-gerrit:
329           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
330           branch: $GERRIT_BRANCH
331           refspec: $GERRIT_REFSPEC
332           wipe_workspace: true
333           clean_before: false
334
335     wrappers:
336       - build-timeout:
337           timeout: 600
338       - credentials-binding:
339           - file:
340               credential-id: '{openrc-credentials-file}'
341               variable: OPENRC_FILE
342           - username-password-separated:
343               credential-id: 'nordix-cicd-arm-credentials'
344               username: NORDIX_ARM_USERNAME
345               password: NORDIX_ARM_TOKEN
346       - mask-passwords
347       - fix-workspace-permissions
348
349     builders:
350       - 'generate-ssh-keypair-macro'
351       - 'wait-pkg-mgr-macro'
352       - 'download-deploy-artifact-macro'
353       - 'deploy-macro'
354
355 - job-template:
356     name: 'onap-verify-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
357
358     disabled: '{obj:disabled}'
359
360     concurrent: true
361
362     properties:
363       - logrotate
364       - throttle:
365           max-per-node: 1
366           max-total: 3
367           option: project
368
369     scm:
370       - git-scm-gerrit:
371           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
372           branch: $GERRIT_BRANCH
373           refspec: $GERRIT_REFSPEC
374           wipe_workspace: true
375           clean_before: false
376
377     wrappers:
378       - build-timeout:
379           timeout: 600
380       - credentials-binding:
381           - file:
382               credential-id: '{openrc-credentials-file}'
383               variable: OPENRC_FILE
384           - username-password-separated:
385               credential-id: 'nordix-cicd-arm-credentials'
386               username: NORDIX_ARM_USERNAME
387               password: NORDIX_ARM_TOKEN
388       - mask-passwords
389       - fix-workspace-permissions
390
391     builders:
392       - 'generate-ssh-keypair-macro'
393       - 'wait-pkg-mgr-macro'
394       - 'download-deploy-artifact-macro'
395       - 'deploy-macro'
396 - job-template:
397     name: 'onap-verify-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
398
399     disabled: '{obj:disabled}'
400
401     parameters:
402       - string:
403           name: EXECUTION_MODE
404           default: '{execution-mode}'
405           description: 'Execution mode'
406       - string:
407           name: TEST_REPO_URL
408           default: 'https://gerrit.nordix.org/infra/test.git'
409           description: 'URL to clone the test repo from'
410       - string:
411           name: TEST_FW
412           default: 'xtesting'
413           description: 'Test framework to use'
414       - string:
415           name: TEST_SUITE
416           default: 'infra-healthcheck'
417           description: 'Test suite to run'
418
419     properties:
420       - logrotate
421       - throttle:
422           max-per-node: 1
423           max-total: 3
424           option: project
425     wrappers:
426       - build-timeout:
427           timeout: 600
428       - mask-passwords
429       - fix-workspace-permissions
430
431     builders:
432       - 'xtesting-infra-healthcheck-macro'
433
434 - job-template:
435     name: 'onap-verify-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
436
437     disabled: '{obj:disabled}'
438
439     parameters:
440       - string:
441           name: EXECUTION_MODE
442           default: '{execution-mode}'
443           description: 'Execution mode'
444       - string:
445           name: TEST_REPO_URL
446           default: 'https://gerrit.nordix.org/infra/test.git'
447           description: 'URL to clone the test repo from'
448       - string:
449           name: TEST_FW
450           default: 'xtesting'
451           description: 'Test framework to use'
452       - string:
453           name: TEST_SUITE
454           default: 'healthcheck'
455           description: 'Test suite to run'
456
457     properties:
458       - logrotate
459       - throttle:
460           max-per-node: 1
461           max-total: 3
462           option: project
463     wrappers:
464       - build-timeout:
465           timeout: 600
466       - mask-passwords
467       - fix-workspace-permissions
468
469     builders:
470       - 'xtesting-healthcheck-macro'
471