engine: Use multi-worker heat template in CI
[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
60     cloud:
61       - city:
62           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
63
64     dependency-jobs: 'ironic-verify-package-{distro}-{stream}'
65     dependency-job-var: 'TRIGGER_ironic_verify_package_{distro}_{stream}_BUILD_RESULT'
66
67     jobs:
68       - 'ironic-verify-{environment-type}-provision-{distro}-{cloud}-{type}-{stream}'
69
70 - job-template:
71     name: 'ironic-verify-{environment-type}-provision-{distro}-{cloud}-{type}-{stream}'
72
73     disabled: '{obj:disabled}'
74
75     concurrent: true
76
77     parameters:
78       - string:
79           name: DEPLOY_SCENARIO
80           default: '{deploy-scenario}'
81           description: 'Scenario to test change with. This depends on the branch of the stack'
82       - string:
83           name: DISTRO
84           default: '{distro}'
85           description: 'Distribution to use for configuring target nodes (networking etc.)'
86       - label:
87           name: SLAVE_LABEL
88           default: 'engine-{slave-type}-{environment-type}-{distro}-fra'
89           description: 'Slave label to schedule this job on.'
90       - string:
91           name: HW_TYPE
92           default: '{type}'
93           description: 'Hardware type - could be virtual, cloud, or baremetal'
94       - string:
95           name: EXECUTION_MODE
96           default: '{execution-mode}'
97           description: 'Execution mode to run in'
98       - string:
99           name: PDF
100           default: '{pdf}'
101           description: 'PDF file to use for deployment'
102       - string:
103           name: IDF
104           default: '{idf}'
105           description: 'IDF file to use for deployment'
106       - string:
107           name: HEAT_STACK_NAME
108           default: "nordix-cicd-verify-ironic-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
109           description: 'Name of the created stack'
110       - string:
111           name: KEYPAIR_NAME
112           default: "keypair-nordix-cicd-verify-ironic-{environment-type}-{distro}-$GERRIT_CHANGE_NUMBER"
113           description: 'Name of the created keypair'
114       - string:
115           name: USE_PREBUILT_DEPLOYMENT_IMAGE
116           default: 'true'
117           description: 'Use prebuilt deployment image while running as part of CI/CD'
118       - string:
119           name: TEST_REPO_URL
120           default: 'https://gerrit.nordix.org/infra/test.git'
121           description: 'URL to clone the test repo from'
122       - string:
123           name: TEST_FW
124           default: 'functest'
125           description: 'Test framework to use'
126       - string:
127           name: TEST_SUITE
128           default: 'healthcheck'
129           description: 'Test suite to run'
130       - string:
131           name: YARDSTICK_DISPATCHER
132           default: 'file'
133           description: 'Dispatcher to use for Yardstick reporting'
134       - string:
135           name: DELETE_STACK
136           default: 'true'
137           description: 'Delete the stack upon completion of the build'
138       - string:
139           name: VERBOSITY
140           default: 'true'
141           description: 'Verbosity setting for the engine - true or false - default is false'
142       - string:
143           name: CI_LOOP
144           default: "verify"
145           description: 'CI loop the job belongs to'
146       - project-parameters:
147           project: $GERRIT_PROJECT
148           branch: '{branch}'
149           description: 'The project and branch which the change is proposed for'
150       - nordix-gerrit-parameters
151
152     properties:
153       - logrotate
154       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
155       - throttle:
156           enabled: true
157           max-per-node: 1
158           max-total: 8
159           option: category
160           categories:
161             - engine-verify-deploy-test
162
163     scm:
164       - git-scm-gerrit:
165           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
166           branch: $GERRIT_BRANCH
167           refspec: $GERRIT_REFSPEC
168           wipe_workspace: true
169           clean_before: false
170
171     triggers:
172       - gerrit:
173           server-name: 'Nordix Gerrit'
174           trigger-on:
175             - patchset-created-event:
176                 exclude-drafts: 'false'
177                 exclude-trivial-rebase: 'false'
178                 exclude-no-code-change: 'false'
179             - draft-published-event
180             - comment-added-contains-event:
181                 comment-contains-value: 'recheck'
182             - comment-added-contains-event:
183                 comment-contains-value: 'reverify'
184           projects:
185             - project-compare-type: 'REG_EXP'
186               project-pattern: '{gated-projects}'
187               branches:
188                 - branch-compare-type: 'ANT'
189                   branch-pattern: '**/{branch}'
190               disable-strict-forbidden-file-verification: 'true'
191               forbidden-file-paths:
192                 - compare-type: ANT
193                   pattern: 'docs/**|releasenotes/**'
194           skip-vote:
195             successful: '{obj:successful}'
196             failed: '{obj:failed}'
197             unstable: '{obj:unstable}'
198             notbuilt: '{obj:notbuilt}'
199           custom-url: '* $JOB_NAME $BUILD_URL'
200           readable-message: 'true'
201           dependency-jobs: '{dependency-jobs}'
202
203     wrappers:
204       - fix-workspace-permissions
205       - build-timeout:
206           timeout: 180
207       - credentials-binding:
208           - file:
209               credential-id: '{openrc-credentials-file}'
210               variable: OPENRC_FILE
211           - username-password-separated:
212               credential-id: 'nordix-cicd-arm-credentials'
213               username: NORDIX_ARM_USERNAME
214               password: NORDIX_ARM_TOKEN
215       - mask-passwords
216       - openstack:
217           single-use: True
218       - pre-scm-buildstep:
219           failOnError: true
220           buildsteps:
221             - system-groovy:
222                 command: |
223                   def build = this.getProperty('binding').getVariable('build')
224                   def listener = this.getProperty('binding').getVariable('listener')
225                   if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
226                     println "WARN  : Aborting build since dependent job did not succeed!"
227                     throw new InterruptedException()
228                   }}
229             - shell: |
230                 #!/bin/bash
231                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
232                 # offline nodes can not resolve Nordix Artifactory and Gerrit
233                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
234                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
235                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
236                   sudo bash -c "cat << EOF >> /etc/hosts
237                 # managed by engine
238                 91.106.198.25 artifactory.nordix.org
239                 91.106.198.142 gerrit.nordix.org
240                 86.107.242.50 fra1.citycloud.com
241                 # managed by engine
242                 EOF"
243                   # we need to get rid of search domain as well
244                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
245                 fi
246
247     builders:
248       - 'generate-change-metadata-macro'
249       - inject:
250           properties-file: "$WORKSPACE/change.properties"
251       - 'generate-ssh-keypair-macro'
252       - 'download-artifact-macro'
253       - 'wait-pkg-mgr-macro'
254       - 'deploy-macro'
255
256     publishers:
257       - postbuildscript:
258           builders:
259             - role: SLAVE
260               build-on:
261                 - SUCCESS
262                 - FAILURE
263                 - ABORTED
264                 - NOT_BUILT
265                 - UNSTABLE
266               build-steps:
267                 - 'wait-pkg-mgr-macro'
268                 - 'delete-stack-macro'