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