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