add ccsdk-sli-northbound
[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: 'master'
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: true
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-tox-{stream}'
81     dependency-job-var: 'TRIGGER_onap_verify_tox_{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: STACK_TYPE
131           default: 'onap'
132           description: 'Stack to package, deploy, test, release'
133       - string:
134           name: PDF
135           default: '{pdf}'
136           description: 'PDF file to use for deployment'
137       - string:
138           name: IDF
139           default: '{idf}'
140           description: 'IDF file to use for deployment'
141       - string:
142           name: HEAT_STACK_NAME
143           default: "nordix-cicd-verify-onap-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
144           description: 'Name of the created stack'
145       - string:
146           name: KEYPAIR_NAME
147           default: "keypair-nordix-cicd-verify-onap-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
148           description: 'Name of the created keypair'
149       - string:
150           name: USE_PREBUILT_DEPLOYMENT_IMAGE
151           default: 'true'
152           description: 'Use prebuilt deployment image while running as part of CI/CD'
153       - string:
154           name: DELETE_STACK
155           default: 'false'
156           description: 'Delete the stack upon completion of the build'
157       - string:
158           name: VERBOSITY
159           default: 'true'
160           description: 'Verbosity setting for the engine - true or false - default is false'
161       - string:
162           name: CI_LOOP
163           default: "verify"
164           description: 'CI loop the job belongs to'
165       - project-parameters:
166           project: $GERRIT_PROJECT
167           branch: '{branch}'
168           description: 'The project and branch which the change is proposed for'
169       - nordix-gerrit-parameters
170
171     properties:
172       - logrotate
173       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
174       - throttle:
175           enabled: true
176           max-per-node: 1
177           max-total: 8
178           option: category
179           categories:
180             - engine-verify-deploy-test
181
182     scm:
183       - git-scm-gerrit:
184           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
185           branch: $GERRIT_BRANCH
186           refspec: $GERRIT_REFSPEC
187           wipe_workspace: true
188           clean_before: false
189
190     triggers:
191       - gerrit:
192           server-name: 'Nordix Gerrit'
193           trigger-on:
194             - patchset-created-event:
195                 exclude-drafts: 'false'
196                 exclude-trivial-rebase: 'false'
197                 exclude-no-code-change: 'false'
198             - draft-published-event
199             - comment-added-contains-event:
200                 comment-contains-value: 'recheck'
201             - comment-added-contains-event:
202                 comment-contains-value: 'reverify'
203           projects:
204             - project-compare-type: 'REG_EXP'
205               project-pattern: '{gated-projects}'
206               branches:
207                 - branch-compare-type: 'ANT'
208                   branch-pattern: '**/{branch}'
209               disable-strict-forbidden-file-verification: 'true'
210               forbidden-file-paths:
211                 - compare-type: ANT
212                   pattern: 'docs/**|releasenotes/**'
213           skip-vote:
214             successful: '{obj:successful}'
215             failed: '{obj:failed}'
216             unstable: '{obj:unstable}'
217             notbuilt: '{obj:notbuilt}'
218           custom-url: '* $JOB_NAME $BUILD_URL'
219           readable-message: 'true'
220           dependency-jobs: '{dependency-jobs}'
221
222     wrappers:
223       - build-timeout:
224           timeout: 600
225       - ssh-agent-credentials:
226           users:
227             - 'nordixinfra-nordix-gerrit-ssh'
228       - credentials-binding:
229           - file:
230               credential-id: '{openrc-credentials-file}'
231               variable: OPENRC_FILE
232           - username-password-separated:
233               credential-id: 'nordix-cicd-arm-credentials'
234               username: NORDIX_ARM_USERNAME
235               password: NORDIX_ARM_TOKEN
236       - mask-passwords
237       - openstack:
238           single-use: True
239       - pre-scm-buildstep:
240           failOnError: true
241           buildsteps:
242             - system-groovy:
243                 command: |
244                   def build = this.getProperty('binding').getVariable('build')
245                   def listener = this.getProperty('binding').getVariable('listener')
246                   if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
247                     println "WARN  : Aborting build since dependent job did not succeed!"
248                     throw new InterruptedException()
249                   }}
250             - shell: |
251                 #!/bin/bash
252                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
253                 # offline nodes can not resolve Nordix Artifactory and Gerrit
254                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
255                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
256                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
257                   sudo bash -c "cat << EOF >> /etc/hosts
258                 # managed by engine
259                 91.106.198.25 artifactory.nordix.org
260                 91.106.198.142 gerrit.nordix.org
261                 86.107.242.50 fra1.citycloud.com
262                 # managed by engine
263                 EOF"
264                   # we need to get rid of search domain as well
265                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
266                 fi
267
268     builders:
269       - 'generate-change-metadata-macro'
270       - 'generate-k8sdeployment-environment-macro'
271       - multijob:
272           name: "{environment-type} deployment on {type} instances"
273           condition: SUCCESSFUL
274           execution-type: SEQUENTIALLY
275           projects:
276             - name: 'onap-verify-{environment-type}-deployk8s-{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/k8s.properties
283             - name: 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
284               current-parameters: true
285               git-revision: true
286               node-parameters: true
287               kill-phase-on: FAILURE
288               abort-all-job: false
289               property-file: $WORKSPACE/change.properties
290       - multijob:
291           name: xTesting for infra-healthcheck and healthcheck
292           condition: ALWAYS
293           projects:
294             - name: 'onap-verify-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
295               current-parameters: true
296               git-revision: true
297               node-parameters: true
298               kill-phase-on: FAILURE
299               abort-all-job: false
300               property-file: $WORKSPACE/change.properties
301             - name: 'onap-verify-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
302               current-parameters: true
303               git-revision: true
304               node-parameters: true
305               kill-phase-on: FAILURE
306               abort-all-job: false
307     publishers:
308       - postbuildscript:
309           builders:
310             - role: SLAVE
311               build-on:
312                 - SUCCESS
313                 - FAILURE
314                 - ABORTED
315                 - NOT_BUILT
316                 - UNSTABLE
317               build-steps:
318                 - 'wait-pkg-mgr-macro'
319                 - 'delete-stack-macro'
320
321 - job-template:
322     name: 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
323
324     disabled: '{obj:disabled}'
325
326     concurrent: true
327
328     properties:
329       - logrotate
330       - throttle:
331           max-per-node: 1
332           max-total: 3
333           option: project
334
335     scm:
336       - git-scm-gerrit:
337           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
338           branch: $GERRIT_BRANCH
339           refspec: $GERRIT_REFSPEC
340           wipe_workspace: true
341           clean_before: false
342
343     wrappers:
344       - build-timeout:
345           timeout: 600
346       - credentials-binding:
347           - file:
348               credential-id: '{openrc-credentials-file}'
349               variable: OPENRC_FILE
350           - username-password-separated:
351               credential-id: 'nordix-cicd-arm-credentials'
352               username: NORDIX_ARM_USERNAME
353               password: NORDIX_ARM_TOKEN
354       - mask-passwords
355       - fix-workspace-permissions
356
357     builders:
358       - 'generate-ssh-keypair-macro'
359       - 'wait-pkg-mgr-macro'
360       - 'download-deploy-artifact-macro'
361       - 'deploy-macro'
362
363 - job-template:
364     name: 'onap-verify-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
365
366     disabled: '{obj:disabled}'
367
368     concurrent: true
369
370     properties:
371       - logrotate
372       - throttle:
373           max-per-node: 1
374           max-total: 3
375           option: project
376
377     scm:
378       - git-scm-gerrit:
379           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
380           branch: $GERRIT_BRANCH
381           refspec: $GERRIT_REFSPEC
382           wipe_workspace: true
383           clean_before: false
384
385     wrappers:
386       - build-timeout:
387           timeout: 600
388       - credentials-binding:
389           - file:
390               credential-id: '{openrc-credentials-file}'
391               variable: OPENRC_FILE
392           - username-password-separated:
393               credential-id: 'nordix-cicd-arm-credentials'
394               username: NORDIX_ARM_USERNAME
395               password: NORDIX_ARM_TOKEN
396       - mask-passwords
397       - fix-workspace-permissions
398
399     builders:
400       - 'generate-ssh-keypair-macro'
401       - 'wait-pkg-mgr-macro'
402       - 'download-deploy-artifact-macro'
403       - 'deploy-macro'
404 - job-template:
405     name: 'onap-verify-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
406
407     disabled: '{obj:disabled}'
408
409     parameters:
410       - string:
411           name: EXECUTION_MODE
412           default: '{execution-mode}'
413           description: 'Execution mode'
414       - string:
415           name: TEST_REPO_URL
416           default: 'https://gerrit.nordix.org/infra/test.git'
417           description: 'URL to clone the test repo from'
418       - string:
419           name: TEST_FW
420           default: 'xtesting'
421           description: 'Test framework to use'
422       - string:
423           name: TEST_SUITE
424           default: 'infra-healthcheck'
425           description: 'Test suite to run'
426
427     properties:
428       - logrotate
429       - throttle:
430           max-per-node: 1
431           max-total: 3
432           option: project
433     wrappers:
434       - build-timeout:
435           timeout: 600
436       - mask-passwords
437       - fix-workspace-permissions
438
439     builders:
440       - 'download-xtesting-artifact-macro'
441       - 'xtesting-infra-healthcheck-macro'
442
443 - job-template:
444     name: 'onap-verify-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
445
446     disabled: '{obj:disabled}'
447
448     parameters:
449       - string:
450           name: EXECUTION_MODE
451           default: '{execution-mode}'
452           description: 'Execution mode'
453       - string:
454           name: TEST_REPO_URL
455           default: 'https://gerrit.nordix.org/infra/test.git'
456           description: 'URL to clone the test repo from'
457       - string:
458           name: TEST_FW
459           default: 'xtesting'
460           description: 'Test framework to use'
461       - string:
462           name: TEST_SUITE
463           default: 'healthcheck'
464           description: 'Test suite to run'
465
466     properties:
467       - logrotate
468       - throttle:
469           max-per-node: 1
470           max-total: 3
471           option: project
472     wrappers:
473       - build-timeout:
474           timeout: 600
475       - mask-passwords
476       - fix-workspace-permissions
477
478     builders:
479       - 'wait-pkg-mgr-macro'
480       - 'xtesting-healthcheck-macro'
481