Add xTesting packaging and Offline execution support
[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: 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       - credentials-binding:
226           - file:
227               credential-id: '{openrc-credentials-file}'
228               variable: OPENRC_FILE
229           - username-password-separated:
230               credential-id: 'nordix-cicd-arm-credentials'
231               username: NORDIX_ARM_USERNAME
232               password: NORDIX_ARM_TOKEN
233       - mask-passwords
234       - openstack:
235           single-use: True
236       - pre-scm-buildstep:
237           failOnError: true
238           buildsteps:
239             - system-groovy:
240                 command: |
241                   def build = this.getProperty('binding').getVariable('build')
242                   def listener = this.getProperty('binding').getVariable('listener')
243                   if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
244                     println "WARN  : Aborting build since dependent job did not succeed!"
245                     throw new InterruptedException()
246                   }}
247             - shell: |
248                 #!/bin/bash
249                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
250                 # offline nodes can not resolve Nordix Artifactory and Gerrit
251                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
252                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
253                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
254                   sudo bash -c "cat << EOF >> /etc/hosts
255                 # managed by engine
256                 91.106.198.25 artifactory.nordix.org
257                 91.106.198.142 gerrit.nordix.org
258                 86.107.242.50 fra1.citycloud.com
259                 # managed by engine
260                 EOF"
261                   # we need to get rid of search domain as well
262                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
263                 fi
264
265     builders:
266       - 'generate-change-metadata-macro'
267       - 'generate-k8sdeployment-environment-macro'
268       - multijob:
269           name: "{environment-type} deployment on {type} instances"
270           condition: SUCCESSFUL
271           execution-type: SEQUENTIALLY
272           projects:
273             - name: 'onap-verify-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
274               current-parameters: true
275               git-revision: true
276               node-parameters: true
277               kill-phase-on: FAILURE
278               abort-all-job: false
279               property-file: $WORKSPACE/k8s.properties
280             - name: 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
281               current-parameters: true
282               git-revision: true
283               node-parameters: true
284               kill-phase-on: FAILURE
285               abort-all-job: false
286               property-file: $WORKSPACE/change.properties
287       - multijob:
288           name: xTesting for infra-healthcheck and healthcheck
289           condition: ALWAYS
290           projects:
291             - name: 'onap-verify-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
292               current-parameters: true
293               git-revision: true
294               node-parameters: true
295               kill-phase-on: FAILURE
296               abort-all-job: false
297             - name: 'onap-verify-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
298               current-parameters: true
299               git-revision: true
300               node-parameters: true
301               kill-phase-on: FAILURE
302               abort-all-job: false
303     publishers:
304       - postbuildscript:
305           builders:
306             - role: SLAVE
307               build-on:
308                 - SUCCESS
309                 - FAILURE
310                 - ABORTED
311                 - NOT_BUILT
312                 - UNSTABLE
313               build-steps:
314                 - 'wait-pkg-mgr-macro'
315                 - 'delete-stack-macro'
316
317 - job-template:
318     name: 'onap-verify-{environment-type}-deploy-{distro}-{cloud}-{type}-{stream}'
319
320     disabled: '{obj:disabled}'
321
322     concurrent: true
323
324     properties:
325       - logrotate
326       - throttle:
327           max-per-node: 1
328           max-total: 3
329           option: project
330
331     scm:
332       - git-scm-gerrit:
333           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
334           branch: $GERRIT_BRANCH
335           refspec: $GERRIT_REFSPEC
336           wipe_workspace: true
337           clean_before: false
338
339     wrappers:
340       - build-timeout:
341           timeout: 600
342       - credentials-binding:
343           - file:
344               credential-id: '{openrc-credentials-file}'
345               variable: OPENRC_FILE
346           - username-password-separated:
347               credential-id: 'nordix-cicd-arm-credentials'
348               username: NORDIX_ARM_USERNAME
349               password: NORDIX_ARM_TOKEN
350       - mask-passwords
351       - fix-workspace-permissions
352
353     builders:
354       - 'generate-ssh-keypair-macro'
355       - 'wait-pkg-mgr-macro'
356       - 'download-deploy-artifact-macro'
357       - 'deploy-macro'
358
359 - job-template:
360     name: 'onap-verify-{environment-type}-deployk8s-{distro}-{cloud}-{type}-{stream}'
361
362     disabled: '{obj:disabled}'
363
364     concurrent: true
365
366     properties:
367       - logrotate
368       - throttle:
369           max-per-node: 1
370           max-total: 3
371           option: project
372
373     scm:
374       - git-scm-gerrit:
375           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
376           branch: $GERRIT_BRANCH
377           refspec: $GERRIT_REFSPEC
378           wipe_workspace: true
379           clean_before: false
380
381     wrappers:
382       - build-timeout:
383           timeout: 600
384       - credentials-binding:
385           - file:
386               credential-id: '{openrc-credentials-file}'
387               variable: OPENRC_FILE
388           - username-password-separated:
389               credential-id: 'nordix-cicd-arm-credentials'
390               username: NORDIX_ARM_USERNAME
391               password: NORDIX_ARM_TOKEN
392       - mask-passwords
393       - fix-workspace-permissions
394
395     builders:
396       - 'generate-ssh-keypair-macro'
397       - 'wait-pkg-mgr-macro'
398       - 'download-deploy-artifact-macro'
399       - 'deploy-macro'
400 - job-template:
401     name: 'onap-verify-{environment-type}-xtesting-infra-healthcheck-{distro}-{cloud}-{type}-{stream}'
402
403     disabled: '{obj:disabled}'
404
405     parameters:
406       - string:
407           name: EXECUTION_MODE
408           default: '{execution-mode}'
409           description: 'Execution mode'
410       - string:
411           name: TEST_REPO_URL
412           default: 'https://gerrit.nordix.org/infra/test.git'
413           description: 'URL to clone the test repo from'
414       - string:
415           name: TEST_FW
416           default: 'xtesting'
417           description: 'Test framework to use'
418       - string:
419           name: TEST_SUITE
420           default: 'infra-healthcheck'
421           description: 'Test suite to run'
422
423     properties:
424       - logrotate
425       - throttle:
426           max-per-node: 1
427           max-total: 3
428           option: project
429     wrappers:
430       - build-timeout:
431           timeout: 600
432       - mask-passwords
433       - fix-workspace-permissions
434
435     builders:
436       - 'download-deploy-artifact-macro'
437       - 'xtesting-healthcheck-macro'
438       - 'xtesting-infra-healthcheck-macro'
439
440 - job-template:
441     name: 'onap-verify-{environment-type}-xtesting-healthcheck-{distro}-{cloud}-{type}-{stream}'
442
443     disabled: '{obj:disabled}'
444
445     parameters:
446       - string:
447           name: EXECUTION_MODE
448           default: '{execution-mode}'
449           description: 'Execution mode'
450       - string:
451           name: TEST_REPO_URL
452           default: 'https://gerrit.nordix.org/infra/test.git'
453           description: 'URL to clone the test repo from'
454       - string:
455           name: TEST_FW
456           default: 'xtesting'
457           description: 'Test framework to use'
458       - string:
459           name: TEST_SUITE
460           default: 'healthcheck'
461           description: 'Test suite to run'
462
463     properties:
464       - logrotate
465       - throttle:
466           max-per-node: 1
467           max-total: 3
468           option: project
469     wrappers:
470       - build-timeout:
471           timeout: 600
472       - mask-passwords
473       - fix-workspace-permissions
474
475     builders:
476       - 'wait-pkg-mgr-macro'
477       - 'download-deploy-artifact-macro'
478       - 'xtesting-healthcheck-macro'
479