engine: Create job skeletons for ansible lint and shellcheck
[infra/cicd.git] / jjb / cloud-infra / cloud-infra-engine-verify-deploy.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
54     distro:
55       - ubuntu1804:
56           disabled: false
57           successful: false
58           failed: false
59           unstable: false
60           notbuilt: false
61       - centos7:
62           disabled: true
63           successful: true
64           failed: true
65           unstable: true
66           notbuilt: true
67     cloud:
68       - city:
69           openrc-credentials-file: 'est-jenkins-openrcfile-city-karlskrona-onap'
70
71     type:
72       - virtual:
73           provisioner-type: 'bifrost'
74           slave-type: 'vpod'
75       - cloud:
76           provisioner-type: 'heat'
77           slave-type: 'jumphost'
78
79     phase:
80       - deploy:
81           build-timeout: 90
82       - functest:
83           build-timeout: 60
84
85     jobs:
86       - 'cloud-infra-verify-engine-{distro}-{cloud}-{type}-{stream}'
87       - 'cloud-infra-verify-engine-{distro}-{phase}-{type}-{stream}'
88
89 - job-template:
90     name: 'cloud-infra-verify-engine-{distro}-{cloud}-{type}-{stream}'
91
92     project-type: multijob
93
94     disabled: '{obj:disabled}'
95
96     concurrent: true
97
98     parameters:
99       - project-parameters:
100           project: '{project}'
101           branch: '{branch}'
102       - nordix-gerrit-parameters
103       - label:
104           name: SLAVE_LABEL
105           default: '{cloud}-{slave-type}-{distro}'
106           description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use'
107       - string:
108           name: DISTRO
109           default: '{distro}'
110           description: 'Distribution to use for configuring target nodes (networking etc.)'
111       - string:
112           name: PROVISIONER_TYPE
113           default: '{provisioner-type}'
114           description: 'Provisioner type to use'
115       - string:
116           name: DEPLOY_TYPE
117           default: '{type}'
118           description: 'Type of the deployment'
119       - string:
120           name: HEAT_ENVIRONMENT_FILENAME
121           default: 'heat-environment-{cloud}-{distro}.yaml'
122           description: 'Name of heat-environment file to use.'
123       - string:
124           name: STACK_NAME
125           default: "nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
126           description: 'Name of the created stack'
127       - string:
128           name: USE_PREBUILT_DEPLOYMENT_IMAGE
129           default: 'true'
130           description: 'Use prebuilt deployment image while running as part of CI/CD'
131       - string:
132           name: TEST_SUITE
133           default: 'healthcheck'
134           description: 'Test suite to run'
135       - string:
136           name: YARDSTICK_DISPATCHER
137           default: 'file'
138           description: 'Dispatcher to use for Yardstick reporting'
139       - string:
140           name: DELETE_STACK
141           default: 'yes'
142           description: 'Delete the stack upon completion of the build'
143       - string:
144           name: CLEANUP
145           default: 'true'
146           description: 'Cleanup leftovers of the previous run'
147
148     properties:
149       - logrotate
150       - build-blocker:
151           use-build-blocker: true
152           blocking-jobs:
153             - 'cloud-infra-verify-engine-.*'
154             - 'cloud-infra-verify-scenario-.*'
155             - 'cloud-infra-periodic-engine-.*'
156             - 'k8-.*'
157             - 'nolabs-.*'
158           block-level: 'NODE'
159       - throttle:
160           max-per-node: 1
161           max-total: 3
162           option: project
163
164     wrappers:
165       - credentials-binding:
166           - file:
167               credential-id: '{openrc-credentials-file}'
168               variable: OPENRC_FILE
169       - mask-passwords
170       - build-timeout:
171           timeout: 150
172       - fix-workspace-permissions
173       - openstack:
174           single-use: True
175
176     scm:
177       - git-scm-gerrit:
178           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
179           branch: '{branch}'
180           refspec: $GERRIT_REFSPEC
181           wipe_workspace: true
182           clean_before: false
183
184     triggers:
185       - gerrit:
186           server-name: 'Nordix Gerrit'
187           trigger-on:
188             - patchset-created-event:
189                 exclude-drafts: 'false'
190                 exclude-trivial-rebase: 'false'
191                 exclude-no-code-change: 'false'
192             - draft-published-event
193             - comment-added-contains-event:
194                 comment-contains-value: 'recheck'
195             - comment-added-contains-event:
196                 comment-contains-value: 'reverify'
197           projects:
198             - project-compare-type: 'REG_EXP'
199               project-pattern: 'infra\/engine'
200               branches:
201                 - branch-compare-type: 'ANT'
202                   branch-pattern: '**/{branch}'
203               file-paths:
204                 - compare-type: 'ANT'
205                   pattern: '**'
206           skip-vote:
207             successful: '{obj:successful}'
208             failed: '{obj:failed}'
209             unstable: '{obj:unstable}'
210             notbuilt: '{obj:notbuilt}'
211           custom-url: '* $JOB_NAME $BUILD_URL'
212
213     builders:
214       - shell: |
215           #!/bin/bash
216           cp $OPENRC_FILE /tmp/openrc
217       - 'cloud-infra-determine-scenario-macro'
218       - multijob:
219           name: deploy
220           condition: SUCCESSFUL
221           projects:
222             - name: 'cloud-infra-verify-engine-{distro}-deploy-{type}-{stream}'
223               current-parameters: true
224               predefined-parameters: |
225                 DISTRO=$DISTRO
226                 DEPLOY_TYPE=$DEPLOY_TYPE
227                 PROVISIONER_TYPE=$PROVISIONER_TYPE
228                 STACK_NAME=$STACK_NAME
229                 HEAT_ENVIRONMENT_FILENAME=$HEAT_ENVIRONMENT_FILENAME
230                 USE_PREBUILT_DEPLOYMENT_IMAGE=$USE_PREBUILT_DEPLOYMENT_IMAGE
231                 CLEANUP=$CLEANUP
232                 GERRIT_PROJECT=$GERRIT_PROJECT
233                 GERRIT_BRANCH=$GERRIT_BRANCH
234                 GERRIT_REFSPEC=$GERRIT_REFSPEC
235                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
236                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
237               node-parameters: true
238               kill-phase-on: FAILURE
239               abort-all-job: true
240       - multijob:
241           name: functest
242           condition: SUCCESSFUL
243           projects:
244             - name: 'cloud-infra-verify-engine-{distro}-functest-{type}-{stream}'
245               current-parameters: true
246               predefined-parameters: |
247                 DISTRO=$DISTRO
248                 DEPLOY_TYPE=$DEPLOY_TYPE
249                 PROVISIONER_TYPE=$PROVISIONER_TYPE
250                 STACK_NAME=$STACK_NAME
251                 HEAT_ENVIRONMENT_FILENAME=$HEAT_ENVIRONMENT_FILENAME
252                 USE_PREBUILT_DEPLOYMENT_IMAGE=$USE_PREBUILT_DEPLOYMENT_IMAGE
253                 TEST_SUITE=$TEST_SUITE
254                 YARDSTICK_DISPATCHER=$YARDSTICK_DISPATCHER
255                 CLEANUP=$CLEANUP
256                 GERRIT_PROJECT=$GERRIT_PROJECT
257                 GERRIT_BRANCH=$GERRIT_BRANCH
258                 GERRIT_REFSPEC=$GERRIT_REFSPEC
259                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
260                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
261               node-parameters: true
262               kill-phase-on: FAILURE
263               abort-all-job: true
264
265     publishers:
266       - postbuildscript:
267           builders:
268             - role: SLAVE
269               build-on:
270                 - SUCCESS
271                 - FAILURE
272                 - ABORTED
273                 - NOT_BUILT
274                 - UNSTABLE
275               build-steps:
276                 - shell:
277                     !include-raw-escape: ./wait-for-pkg-manager.sh
278                 - shell:
279                     !include-raw: ./delete-heat-stack.sh
280
281 - job-template:
282     name: 'cloud-infra-verify-engine-{distro}-{phase}-{type}-{stream}'
283
284     disabled: false
285
286     concurrent: true
287
288     properties:
289       - logrotate
290
291     parameters:
292       - string:
293           name: PROJECT
294           default: $GERRIT_PROJECT
295       - string:
296           name: DISTRO
297           default: 'ubuntu1804'
298           description: 'Distribution to use for configuring target nodes (networking etc.). Overriden by upstream job.'
299       - string:
300           name: DEPLOY_TYPE
301           default: 'virtual'
302           description: 'Type of the deployment. Overriden by upstream job.'
303       - string:
304           name: PROVISIONER_TYPE
305           default: 'bifrost'
306           description: 'Provisioner type to use. Overriden by upstream job.'
307       - string:
308           name: HEAT_ENVIRONMENT_FILENAME
309           default: "heat-environment-city-ubuntu1804.yaml"
310           description: 'Name of heat-environment file to use.'
311       - string:
312           name: HEAT_ENVIRONMENT_FILE
313           default: "file://$WORKSPACE/engine/provisioner/heat/playbooks/roles/install-configure-heat/files/$HEAT_ENVIRONMENT_FILENAME"
314           description: 'Location of heat-environment file to use.'
315       - string:
316           name: STACK_NAME
317           default: "nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
318           description: 'Name of the created stack'
319       - string:
320           name: USE_PREBUILT_DEPLOYMENT_IMAGE
321           default: 'false'
322           description: 'Use prebuilt deployment image while running as part of CI/CD'
323       - string:
324           name: TEST_FW
325           default: '{phase}'
326           description: 'Test framework to use'
327       - string:
328           name: TEST_SUITE
329           default: 'healthcheck'
330           description: 'Test suite to run'
331       - string:
332           name: TEST_REPO_URL
333           default: 'https://gerrit.nordix.org/infra/test.git'
334           description: 'URL to Nordix Cloud Infra test repository'
335       - string:
336           name: YARDSTICK_DISPATCHER
337           default: 'file'
338           description: 'Dispatcher to use for Yardstick reporting'
339       - string:
340           name: CLEANUP
341           default: 'false'
342
343     wrappers:
344       - mask-passwords
345       - build-timeout:
346           timeout: '{build-timeout}'
347       - fix-workspace-permissions
348
349     scm:
350       - git-scm-gerrit:
351           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
352           branch: '{branch}'
353           refspec: $GERRIT_REFSPEC
354           wipe_workspace: true
355           clean_before: false
356
357     builders:
358       - 'cloud-infra-determine-scenario-macro'
359       - 'cloud-infra-{phase}-macro'
360
361 # vim: set ts=2 sw=2 expandtab: