engine: Create ironic release jobs
[infra/cicd.git] / jjb / engine / ironic-jobs / ironic-release-jobs.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-release'
22
23     project: 'ironic-release'
24
25     stream:
26       - 'master':
27           branch: 'master'
28           deploy-scenario: 'k8-multus-plugins'
29           promote-stack: 'true'
30
31     environment-type:
32       - offline:
33           disabled: false
34           execution-mode: offline-deployment
35           pdf: 'file:///opt/engine/offline/git/hwconfig/pods'
36           idf: 'file:///opt/engine/offline/git/hwconfig/pods'
37           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
38
39     distro:
40       - ubuntu1804
41
42     phase:
43       - package
44       - promote
45
46     jobs:
47       - 'ironic-release-{distro}-{stream}'
48       - 'ironic-package-{distro}-{stream}'
49       - 'ironic-release-{environment-type}-provision-{distro}-baremetal-{stream}'
50       - 'ironic-promote-{distro}-{stream}'
51
52 - job-template:
53     name: 'ironic-release-{distro}-{stream}'
54
55     project-type: multijob
56
57     disabled: '{obj:disabled}'
58
59     node: 'engine-package-{distro}-fra'
60
61     concurrent: false
62
63     parameters:
64       - string:
65           name: BRANCH
66           default: '{branch}'
67           description: 'Branch the job is created for. DO NOT MODIFY!'
68       - string:
69           name: DISTRO
70           default: '{distro}'
71           description: 'Distribution to provision and configre target nodes with. DO NOT MODIFY!'
72       - string:
73           name: DEPLOY_SCENARIO
74           default: '{deploy-scenario}'
75           description: 'Scenario to test change with. This depends on the branch of the stack.'
76       - string:
77           name: CI_LOOP
78           default: 'release'
79           description: 'CI loop type. DO NOT MODIFY!'
80       - string:
81           name: VERBOSITY
82           default: 'false'
83           description: 'Engine verbosity'
84       - string:
85           name: NORDIX_ENGINE_VERSION
86           default: 'master'
87           description: 'Engine version of engine to package, deploy, test, release'
88       - string:
89           name: STACK_TYPE
90           default: 'ironic'
91           description: 'Stack to package, deploy, test, release'
92       - string:
93           name: STACK_VERSION
94           default: '{branch}'
95           description: 'Stack version of engine to package, deploy, test, release'
96       - string:
97           name: NORDIX_BIFROST_VERSION
98           default: 'master'
99           description: 'Bifrost version of engine to package, deploy, test, release'
100       - string:
101           name: PROMOTE_STACK
102           default: '{promote-stack}'
103           description: 'Heat version of engine to package, deploy, test, release'
104
105     properties:
106       - logrotate
107       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
108       - throttle:
109           enabled: true
110           max-per-node: 1
111           max-total: 1
112           option: category
113           categories:
114             - engine-verify-package
115
116     wrappers:
117       - build-timeout:
118           timeout: 600
119       - mask-passwords
120       - fix-workspace-permissions
121       - openstack:
122           single-use: True
123
124     triggers:
125       - pollscm:
126           cron: "#H 0,8,16 * * *"
127
128     scm:
129       - git:
130           url: https://gerrit.nordix.org/infra/engine.git
131           branches:
132             - master
133           timeout: 15
134           wipe-workspace: true
135
136     builders:
137       - 'generate-release-metadata-macro'
138       - inject:
139           properties-file: "$WORKSPACE/release.properties"
140       - 'generate-ssh-keypair-macro'
141       - 'wait-pkg-mgr-macro'
142       - multijob:
143           name: Packaging
144           condition: SUCCESSFUL
145           execution-type: PARALLEL
146           projects:
147             - name: 'ironic-package-{distro}-{stream}'
148               current-parameters: false
149               git-revision: true
150               node-parameters: true
151               property-file: "$WORKSPACE/release.properties"
152               kill-phase-on: FAILURE
153               abort-all-job: true
154       - multijob:
155           name: Provisioning
156           condition: SUCCESSFUL
157           execution-type: PARALLEL
158           projects:
159             - name: 'ironic-release-offline-provision-{distro}-baremetal-{stream}'
160               current-parameters: false
161               git-revision: true
162               node-parameters: false
163               property-file: "$WORKSPACE/release.properties"
164               kill-phase-on: FAILURE
165               abort-all-job: true
166       - multijob:
167           name: Promotion
168           condition: SUCCESSFUL
169           execution-type: PARALLEL
170           projects:
171             - name: 'ironic-promote-{distro}-{stream}'
172               current-parameters: false
173               git-revision: true
174               node-parameters: true
175               property-file: "$WORKSPACE/release.properties"
176               kill-phase-on: FAILURE
177               abort-all-job: true
178
179 - job-template:
180     name: 'ironic-package-{distro}-{stream}'
181
182     disabled: '{obj:disabled}'
183
184     concurrent: false
185
186     parameters:
187       - string:
188           name: EXECUTION_MODE
189           default: 'packaging'
190           description: 'Execution mode to run engine'
191
192     properties:
193       - logrotate
194
195     wrappers:
196       - build-timeout:
197           timeout: 70
198       - credentials-binding:
199           - username-password-separated:
200               credential-id: 'nordix-cicd-arm-credentials'
201               username: NORDIX_ARM_USERNAME
202               password: NORDIX_ARM_TOKEN
203       - mask-passwords
204       - fix-workspace-permissions
205
206     scm:
207       - git:
208           url: https://gerrit.nordix.org/infra/engine.git
209           branches:
210             - master
211           timeout: 15
212           wipe-workspace: true
213
214     builders:
215       - 'package-macro'
216       - 'upload-artifact-macro'
217
218 - job-template:
219     name: 'ironic-promote-{distro}-{stream}'
220
221     disabled: '{obj:disabled}'
222
223     concurrent: false
224
225     properties:
226       - logrotate
227
228     wrappers:
229       - build-timeout:
230           timeout: 30
231       - credentials-binding:
232           - username-password-separated:
233               credential-id: 'nordix-cicd-arm-credentials'
234               username: NORDIX_ARM_USERNAME
235               password: NORDIX_ARM_TOKEN
236       - mask-passwords
237       - fix-workspace-permissions
238
239     scm:
240       - git:
241           url: https://gerrit.nordix.org/infra/engine.git
242           branches:
243             - master
244           timeout: 15
245           wipe-workspace: true
246
247     builders:
248       - 'promote-macro'
249
250 - job-template:
251     name: 'ironic-release-{environment-type}-provision-{distro}-baremetal-{stream}'
252
253     disabled: '{obj:disabled}'
254
255     node: baremetal-deploy
256
257     concurrent: false
258
259     parameters:
260       - string:
261           name: EXECUTION_MODE
262           default: 'offline-deployment'
263           description: 'Engine execution mode'
264       - string:
265           name: PDF
266           default: '{pdf}/${{NODE_NAME}}-pdf.yml'
267           description: 'PDF file to use for deployment. DO NOT MODIFY!'
268       - string:
269           name: IDF
270           default: '{idf}/${{NODE_NAME}}-idf.yml'
271           description: 'IDF file to use for deployment. DO NOT MODIFY!'
272       - string:
273           name: SLAVE_LABEL
274           default: 'baremetal-deploy'
275           description: 'Type of the slave'
276
277     properties:
278       - logrotate
279       - throttle:
280           max-per-node: 1
281           max-total: 1
282           option: project
283
284     wrappers:
285       - build-timeout:
286           timeout: 60
287       - mask-passwords
288       - fix-workspace-permissions
289       - credentials-binding:
290           - file:
291               credential-id: '{openrc-credentials-file}'
292               variable: OPENRC_FILE
293       - pre-scm-buildstep:
294           failOnError: true
295           buildsteps:
296             - shell: |
297                 #!/bin/bash
298                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
299                 # offline nodes can not resolve Nordix Artifactory and Gerrit
300                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
301                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
302                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
303                   sudo bash -c "cat << EOF >> /etc/hosts
304                 # managed by engine
305                 91.106.198.25 artifactory.nordix.org
306                 91.106.198.142 gerrit.nordix.org
307                 86.107.242.50 fra1.citycloud.com
308                 # managed by engine
309                 EOF"
310                   # we need to get rid of search domain as well
311                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
312                 fi
313
314     scm:
315       - git:
316           url: https://gerrit.nordix.org/infra/engine.git
317           branches:
318             - master
319           timeout: 15
320           wipe-workspace: true
321
322     builders:
323       - description-setter:
324           description: provisioning
325       - 'download-artifact-macro'
326       - 'deploy-macro'
327
328 # vim: set ts=2 sw=2 expandtab: