Add jobs to verify changes sent to infra/test repo
[infra/cicd.git] / jjb / cloud-infra / cloud-infra-verify-engine.yaml
1 ---
2 #
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2019 Nordix Foundation.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20
21 #--------------------------------------------------------------------------------------
22 # The jobs declared in this JJB configuration file are used for verifying patches
23 # that are sent to the repositories below
24 #   - cloud-infra/engine
25 #
26 # These jobs verify changes that
27 #   - implement new features or fix bugs for the deployment framework, engine, itself
28 #   - implement new features or fix bugs to the playbooks and roles used for utilizing
29 #     open source components such as bifrost, kubespray, and kolla-ansible
30 #   - bump versions of open source components or the scenarios
31 #
32 # These jobs are set to run on slaves with label vpod-deploy-ubuntu1604.
33 # The slaves have
34 #   - Ubuntu1604 as the base distro
35 #   - nested virtualization
36 #   - internet access
37 #   - passwordless sudo
38 #   - 16 CPUs/32GB RAM/200 GB Disk
39 #   - docker, git vim curl wget zip unzip chrony apt-transport-https ca-certificates curl
40 #     gnupg-agent software-properties-common docker-ce docker-ce-cli containerd.io openjdk-8-jre
41 #
42 # The slaves should not have a cloud infra scenario deployed on them.
43 #--------------------------------------------------------------------------------------
44
45 - project:
46     name: 'cloud-infra-verify-engine'
47
48     project: 'infra/engine'
49
50     stream:
51       - 'master':
52           branch: '{stream}'
53           disabled: 'false'
54
55     os:
56       - ubuntu1804:
57           disabled: 'false'
58           distribution: 'ubuntu18'
59           ipa_dib_os_element: 'coreos'
60           dib_os_release: 'bionic'
61           dib_os_element: 'ubuntu-minimal'
62       - centos7:
63           disabled: 'true'
64           distribution: 'centos7'
65           ipa_dib_os_element: 'coreos'
66           dib_os_release: '7'
67           dib_os_element: 'centos-minimal'
68
69     type:
70       - virtual
71
72     phase:
73       - deploy
74       - test
75
76     jobs:
77       - 'cloud-infra-verify-engine-{os}-{type}-{stream}'
78       - 'cloud-infra-verify-{os}-{phase}-{type}-{stream}'
79
80 - job-template:
81     name: 'cloud-infra-verify-engine-{os}-{type}-{stream}'
82
83     project-type: multijob
84
85     disabled: '{obj:disabled}'
86
87     concurrent: true
88
89     parameters:
90       - project-parameters:
91           project: '{project}'
92           branch: '{branch}'
93       - nordix-gerrit-parameters
94       - label:
95           name: SLAVE_LABEL
96           default: 'vpod-deploy-{os}'
97           description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use'
98       - string:
99           name: DISTRIBUTION
100           default: '{distribution}'
101           description: 'Distribution to use for configuring target nodes (networking etc.)'
102       - string:
103           name: USE_PREBUILT_DEPLOYMENT_IMAGE
104           default: 'true'
105           description: 'Use prebuilt deployment image while running as part of CI/CD'
106       - string:
107           name: IPA_DIB_OS_ELEMENT
108           default: '{ipa_dib_os_element}'
109           description: 'DIB OS Element to use for building the ramdisk image'
110       - string:
111           name: DIB_OS_RELEASE
112           default: '{dib_os_release}'
113           description: 'DIB OS Release to use for building the deployment image to provision target nodes with'
114       - string:
115           name: DIB_OS_ELEMENT
116           default: '{dib_os_element}'
117           description: 'DIB OS Element to use for building the deployment image to provision target nodes with'
118       - string:
119           name: CLEANUP
120           default: 'true'
121           description: 'Cleanup leftovers of the previous run'
122
123     properties:
124       - logrotate
125       - build-blocker:
126           use-build-blocker: true
127           blocking-jobs:
128             - 'cloud-infra-verify-engine-{os}-.*'
129             - 'cloud-infra-os-.*'
130             - 'cloud-infra-k8-.*'
131           block-level: 'NODE'
132       - throttle:
133           max-per-node: 1
134           max-total: 3
135           option: project
136
137     wrappers:
138       - build-timeout:
139           timeout: 120
140       - fix-workspace-permissions
141       - openstack:
142           single-use: True
143
144     scm:
145       - git-scm-gerrit:
146           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
147           branch: '{branch}'
148           refspec: $GERRIT_REFSPEC
149
150     triggers:
151       - nordix-gerrit-trigger-patchset-created:
152           project: 'infra\/engine'
153           branch: '{branch}'
154           files: '**'
155
156     builders:
157       - multijob:
158           name: deploy
159           condition: SUCCESSFUL
160           projects:
161             - name: 'cloud-infra-verify-{os}-deploy-{type}-{stream}'
162               current-parameters: true
163               predefined-parameters: |
164                 DISTRIBUTION=$DISTRIBUTION
165                 USE_PREBUILT_DEPLOYMENT_IMAGE=$USE_PREBUILT_DEPLOYMENT_IMAGE
166                 IPA_DIB_OS_ELEMENT=$IPA_DIB_OS_ELEMENT
167                 DIB_OS_RELEASE=$DIB_OS_RELEASE
168                 DIB_OS_ELEMENT=$DIB_OS_ELEMENT
169                 CLEANUP=$CLEANUP
170                 GERRIT_PROJECT=$GERRIT_PROJECT
171                 GERRIT_BRANCH=$GERRIT_BRANCH
172                 GERRIT_REFSPEC=$GERRIT_REFSPEC
173                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
174                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
175               node-parameters: true
176               kill-phase-on: FAILURE
177               abort-all-job: true
178       - multijob:
179           name: test
180           condition: SUCCESSFUL
181           projects:
182             - name: 'cloud-infra-verify-{os}-test-{type}-{stream}'
183               current-parameters: true
184               predefined-parameters: |
185                 DISTRIBUTION=$DISTRIBUTION
186                 USE_PREBUILT_DEPLOYMENT_IMAGE=$USE_PREBUILT_DEPLOYMENT_IMAGE
187                 IPA_DIB_OS_ELEMENT=$IPA_DIB_OS_ELEMENT
188                 DIB_OS_RELEASE=$DIB_OS_RELEASE
189                 DIB_OS_ELEMENT=$DIB_OS_ELEMENT
190                 CLEANUP=$CLEANUP
191                 GERRIT_PROJECT=$GERRIT_PROJECT
192                 GERRIT_BRANCH=$GERRIT_BRANCH
193                 GERRIT_REFSPEC=$GERRIT_REFSPEC
194                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
195                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
196               node-parameters: true
197               kill-phase-on: test
198               abort-all-job: true
199
200 - job-template:
201     name: 'cloud-infra-verify-{os}-{phase}-{type}-{stream}'
202
203     disabled: false
204
205     concurrent: true
206
207     properties:
208       - logrotate
209
210     parameters:
211       - string:
212           name: PROJECT
213           default: $GERRIT_PROJECT
214       - string:
215           name: DISTRIBUTION
216           default: 'ubuntu18'
217           description: 'Distribution to use for configuring target nodes (networking etc.). Overriden by upstream job.'
218       - string:
219           name: USE_PREBUILT_DEPLOYMENT_IMAGE
220           default: 'false'
221           description: 'Use prebuilt deployment image while running as part of CI/CD'
222       - string:
223           name: IPA_DIB_OS_ELEMENT
224           default: 'fedora'
225           description: 'DIB OS Element to use for building the ramdisk image. Overriden by upstream job.'
226       - string:
227           name: DIB_OS_RELEASE
228           default: 'bionic'
229           description: 'DIB OS Release to use for building the deployment image to provision target nodes with. Overriden by upstream job.'
230       - string:
231           name: DIB_OS_ELEMENT
232           default: 'ubuntu-minimal'
233           description: 'DIB OS Element to use for building the deployment image to provision target nodes with. Overriden by upstream job.'
234       - string:
235           name: CLEANUP
236           default: 'false'
237
238     wrappers:
239       - build-timeout:
240           timeout: 120
241       - fix-workspace-permissions
242
243     scm:
244       - git-scm-gerrit:
245           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
246           branch: '{branch}'
247           refspec: $GERRIT_REFSPEC
248
249     builders:
250       - 'cloud-infra-verify-{phase}-macro'
251
252 # -------------------------------
253 # builder macros
254 # -------------------------------
255
256 - builder:
257     name: 'cloud-infra-verify-deploy-macro'
258     builders:
259       - shell:
260           !include-raw: ./wait-for-pkg-manager.sh
261       - shell:
262           !include-raw: ./cloud-infra-deploy.sh
263
264 - builder:
265     name: 'cloud-infra-verify-test-macro'
266     builders:
267       - shell:
268           !include-raw: ./cloud-infra-test.sh
269
270 # vim: set ts=2 sw=2 expandtab: