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