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