add ccsdk-sli-northbound
[infra/cicd.git] / jjb / cloud-infra / ironic-jobs / ironic-verify-provision.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: 'ironic-verify-provision'
22
23     project: 'ironic-verify-provision'
24
25     stream:
26       - 'master':
27           branch: '{stream}'
28           deploy-scenario: 'k8-multus-plugins'
29
30     environment-type:
31       - online:
32           disabled: false
33           execution-mode: online-deployment
34           successful: false
35           failed: false
36           unstable: false
37           notbuilt: false
38       - offline:
39           disabled: false
40           execution-mode: offline-deployment
41           successful: false
42           failed: false
43           unstable: false
44           notbuilt: false
45
46     phase:
47       - deploy
48
49     type:
50       - virtual:
51           provisioner-type: 'bifrost'
52           slave-type: 'vpod'
53           gated-projects: 'infra/stack/ironic|infra/provisioner/bifrost'
54           pdf: 'https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-pdf.yml'
55           idf: 'https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-idf.yml'
56
57     distro:
58       - ubuntu1804
59       - centos7
60
61     cloud:
62       - city:
63           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
64
65     dependency-jobs: 'ironic-verify-package-{distro}-{stream}'
66     dependency-job-var: 'TRIGGER_ironic_verify_package_{distro}_{stream}_BUILD_RESULT'
67
68     jobs:
69       - 'ironic-verify-{environment-type}-provision-{distro}-{cloud}-{type}-{stream}'
70
71 - job-template:
72     name: 'ironic-verify-{environment-type}-provision-{distro}-{cloud}-{type}-{stream}'
73
74     disabled: '{obj:disabled}'
75
76     concurrent: true
77
78     parameters:
79       - string:
80           name: DEPLOY_SCENARIO
81           default: '{deploy-scenario}'
82           description: 'Scenario to test change with. This depends on the branch of the stack'
83       - string:
84           name: DISTRO
85           default: '{distro}'
86           description: 'Distribution to use for configuring target nodes (networking etc.)'
87       - label:
88           name: SLAVE_LABEL
89           default: 'engine-{slave-type}-{environment-type}-ubuntu1804-fra'
90           description: 'Slave label to schedule this job on.'
91       - string:
92           name: STACK_TYPE
93           default: 'ironic'
94           description: 'Stack type to verify change with'
95       - string:
96           name: HW_TYPE
97           default: '{type}'
98           description: 'Hardware type - could be virtual, cloud, or baremetal'
99       - string:
100           name: EXECUTION_MODE
101           default: '{execution-mode}'
102           description: 'Execution mode to run in'
103       - string:
104           name: PDF
105           default: '{pdf}'
106           description: 'PDF file to use for deployment'
107       - string:
108           name: IDF
109           default: '{idf}'
110           description: 'IDF file to use for deployment'
111       - string:
112           name: HEAT_STACK_NAME
113           default: "nordix-cicd-verify-ironic-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
114           description: 'Name of the created stack'
115       - string:
116           name: KEYPAIR_NAME
117           default: "keypair-nordix-cicd-verify-ironic-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
118           description: 'Name of the created keypair'
119       - string:
120           name: USE_PREBUILT_DEPLOYMENT_IMAGE
121           default: 'true'
122           description: 'Use prebuilt deployment image while running as part of CI/CD'
123       - string:
124           name: TEST_REPO_URL
125           default: 'https://gerrit.nordix.org/infra/test.git'
126           description: 'URL to clone the test repo from'
127       - string:
128           name: TEST_FW
129           default: 'functest'
130           description: 'Test framework to use'
131       - string:
132           name: TEST_SUITE
133           default: 'healthcheck'
134           description: 'Test suite to run'
135       - string:
136           name: YARDSTICK_DISPATCHER
137           default: 'file'
138           description: 'Dispatcher to use for Yardstick reporting'
139       - string:
140           name: DELETE_STACK
141           default: 'true'
142           description: 'Delete the stack upon completion of the build'
143       - string:
144           name: VERBOSITY
145           default: 'true'
146           description: 'Verbosity setting for the engine - true or false - default is false'
147       - string:
148           name: CI_LOOP
149           default: "verify"
150           description: 'CI loop the job belongs to'
151       - project-parameters:
152           project: $GERRIT_PROJECT
153           branch: '{branch}'
154           description: 'The project and branch which the change is proposed for'
155       - nordix-gerrit-parameters
156
157     properties:
158       - logrotate
159       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
160       - throttle:
161           enabled: true
162           max-per-node: 1
163           max-total: 8
164           option: category
165           categories:
166             - engine-verify-deploy-test
167
168     scm:
169       - git-scm-gerrit:
170           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
171           branch: $GERRIT_BRANCH
172           refspec: $GERRIT_REFSPEC
173           wipe_workspace: true
174           clean_before: false
175
176     triggers:
177       - gerrit:
178           server-name: 'Nordix Gerrit'
179           trigger-on:
180             - patchset-created-event:
181                 exclude-drafts: 'false'
182                 exclude-trivial-rebase: 'false'
183                 exclude-no-code-change: 'false'
184             - draft-published-event
185             - comment-added-contains-event:
186                 comment-contains-value: 'recheck'
187             - comment-added-contains-event:
188                 comment-contains-value: 'reverify'
189           projects:
190             - project-compare-type: 'REG_EXP'
191               project-pattern: '{gated-projects}'
192               branches:
193                 - branch-compare-type: 'ANT'
194                   branch-pattern: '**/{branch}'
195               disable-strict-forbidden-file-verification: 'true'
196               forbidden-file-paths:
197                 - compare-type: ANT
198                   pattern: 'docs/**|releasenotes/**'
199           skip-vote:
200             successful: '{obj:successful}'
201             failed: '{obj:failed}'
202             unstable: '{obj:unstable}'
203             notbuilt: '{obj:notbuilt}'
204           custom-url: '* $JOB_NAME $BUILD_URL'
205           readable-message: 'true'
206           dependency-jobs: '{dependency-jobs}'
207
208     wrappers:
209       - fix-workspace-permissions
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       - inject:
255           properties-file: "$WORKSPACE/change.properties"
256       - 'generate-ssh-keypair-macro'
257       - 'download-deploy-artifact-macro'
258       - 'wait-pkg-mgr-macro'
259       - 'deploy-macro'
260
261     publishers:
262       - postbuildscript:
263           builders:
264             - role: SLAVE
265               build-on:
266                 - SUCCESS
267                 - FAILURE
268                 - ABORTED
269                 - NOT_BUILT
270                 - UNSTABLE
271               build-steps:
272                 - 'wait-pkg-mgr-macro'
273                 - 'delete-stack-macro'