engine: Refactor kubernetes release jobs
[infra/cicd.git] / jjb / engine / kubernetes-jobs / kubernetes-release-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: 'kubernetes-deploy-test'
22
23     project: 'kubernetes-deploy-test'
24
25     stream:
26       - 'master':
27           branch: 'master'
28           deploy-scenario: 'k8-multus-plugins'
29       - '1_17':
30           branch: '1.17'
31           deploy-scenario: 'k8-multus-plugins'
32       - '1_16':
33           branch: '1.16'
34           deploy-scenario: 'k8-calico-nofeature'
35       - '1_15':
36           branch: '1.15'
37           deploy-scenario: 'k8-calico-nofeature'
38
39     distro:
40       - ubuntu1804
41
42     environment-type:
43       - offline:
44           disabled: false
45           execution-mode: offline-deployment
46           pdf: 'file:///opt/engine/offline/git/hwconfig/pods'
47           idf: 'file:///opt/engine/offline/git/hwconfig/pods'
48           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
49
50     phase:
51       - deploy:
52           build-timeout: 60
53           execution-mode: offline-deployment
54       - functest:
55           build-timeout: 210
56           execution-mode: online-test
57       - yardstick:
58           build-timeout: 30
59           execution-mode: online-test
60
61     jobs:
62       - 'kubernetes-release-{environment-type}-deploy-test-{distro}-baremetal-{stream}'
63       - 'kubernetes-release-{environment-type}-{phase}-{distro}-baremetal-{stream}'
64
65 - job-template:
66     name: 'kubernetes-release-{environment-type}-deploy-test-{distro}-baremetal-{stream}'
67
68     project-type: multijob
69
70     disabled: '{obj:disabled}'
71
72     node: baremetal-deploy
73
74     concurrent: false
75
76     parameters:
77       - string:
78           name: PDF
79           default: '{pdf}/${{NODE_NAME}}-pdf.yml'
80           description: 'PDF file to use for deployment. DO NOT MODIFY!'
81       - string:
82           name: IDF
83           default: '{idf}/${{NODE_NAME}}-idf.yml'
84           description: 'IDF file to use for deployment. DO NOT MODIFY!'
85       - string:
86           name: SLAVE_LABEL
87           default: 'baremetal-deploy'
88           description: 'Type of the slave'
89
90     properties:
91       - logrotate
92       - throttle:
93           max-per-node: 1
94           max-total: 1
95           option: project
96
97     wrappers:
98       - build-timeout:
99           timeout: 300
100       - mask-passwords
101       - pre-scm-buildstep:
102           failOnError: true
103           buildsteps:
104             - shell: |
105                 #!/bin/bash
106                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
107                 # offline nodes can not resolve Nordix Artifactory and Gerrit
108                 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
109                   echo "Info  : Offline deployment. Adding City OpenStack Endpoint, Nordix Artifactory and Gerrit Public IP to /etc/hosts"
110                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
111                   sudo bash -c "cat << EOF >> /etc/hosts
112                 # managed by engine
113                 91.106.198.25 artifactory.nordix.org
114                 91.106.198.142 gerrit.nordix.org
115                 86.107.242.50 fra1.citycloud.com
116                 # managed by engine
117                 EOF"
118                   # we need to get rid of search domain as well
119                   sudo sed -i 's/^search/# search/' /etc/resolv.conf
120                 fi
121
122     scm:
123       - git:
124           url: https://gerrit.nordix.org/infra/engine.git
125           branches:
126             - master
127           timeout: 15
128           wipe-workspace: true
129
130     builders:
131       - description-setter:
132           description: $DEPLOY_SCENARIO
133       - 'download-artifact-macro'
134       - multijob:
135           name: "Offline Deployment on Baremetal using {deploy-scenario}"
136           condition: SUCCESSFUL
137           execution-type: PARALLEL
138           projects:
139             - name: 'kubernetes-release-{environment-type}-deploy-{distro}-baremetal-{stream}'
140               current-parameters: true
141               git-revision: true
142               node-parameters: true
143               kill-phase-on: FAILURE
144               abort-all-job: true
145       - multijob:
146           name: Functional Testing
147           condition: ALWAYS
148           projects:
149             - name: 'kubernetes-release-{environment-type}-functest-{distro}-baremetal-{stream}'
150               current-parameters: true
151               git-revision: false
152               node-parameters: true
153               kill-phase-on: FAILURE
154               abort-all-job: true
155       - multijob:
156           name: Platform Benchmarking
157           condition: ALWAYS
158           projects:
159             - name: 'kubernetes-release-{environment-type}-yardstick-{distro}-baremetal-{stream}'
160               current-parameters: true
161               git-revision: false
162               node-parameters: true
163               kill-phase-on: FAILURE
164               abort-all-job: true
165
166 - job-template:
167     name: 'kubernetes-release-{environment-type}-{phase}-{distro}-baremetal-{stream}'
168
169     disabled: '{obj:disabled}'
170
171     parameters:
172       - string:
173           name: EXECUTION_MODE
174           default: '{execution-mode}'
175           description: 'Execution mode'
176       - string:
177           name: TEST_REPO_URL
178           default: 'https://gerrit.nordix.org/infra/test.git'
179           description: 'URL to clone the test repo from'
180       - string:
181           name: TEST_FW
182           default: '{phase}'
183           description: 'Test framework to use'
184       - string:
185           name: TEST_SUITE
186           default: 'smoke'
187           description: 'Test suite to run'
188       - string:
189           name: YARDSTICK_DISPATCHER
190           default: 'file'
191           description: 'Dispatcher to use for Yardstick reporting'
192
193     properties:
194       - logrotate
195       - throttle:
196           max-per-node: 1
197           max-total: 1
198           option: project
199
200     wrappers:
201       - build-timeout:
202           timeout: '{build-timeout}'
203       - mask-passwords
204       - fix-workspace-permissions
205       - credentials-binding:
206           - file:
207               credential-id: '{openrc-credentials-file}'
208               variable: OPENRC_FILE
209
210     builders:
211       - description-setter:
212           description: $DEPLOY_SCENARIO
213       - '{phase}-macro'