153776bd8d2cfeac3d7d534fc04b76ff42de5658
[infra/cicd.git] / jjb / cloud-infra / kubernetes-jobs / kubernetes-verify-package.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-verify-package'
22
23     project: 'kubernetes-verify-package'
24
25     # NOTE (fdegir): dot is not an allowed character in groovy var names and also for
26     # naming openstack objects so stream is used for that purpose but branch points to
27     # actual branch name on gerrit
28     stream:
29       - 'master':
30           branch: 'master'
31           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
32           execution-mode: 'packaging'
33           gated-projects: 'infra/stack/kubernetes|infra/installer/kubespray'
34           successful: false
35           failed: false
36           unstable: false
37           notbuilt: false
38           deploy-scenario: 'k8-multus-plugins'
39       - '1_17':
40           branch: '1.17'
41           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
42           execution-mode: 'packaging'
43           gated-projects: 'infra/stack/kubernetes|infra/installer/kubespray'
44           successful: false
45           failed: false
46           unstable: false
47           notbuilt: false
48           deploy-scenario: 'k8-multus-plugins'
49       - '1_16':
50           branch: '1.16'
51           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
52           execution-mode: 'packaging'
53           gated-projects: 'infra/stack/kubernetes|infra/installer/kubespray'
54           successful: false
55           failed: false
56           unstable: false
57           notbuilt: false
58           deploy-scenario: 'k8-calico-nofeature'
59       - '1_15':
60           branch: '1.15'
61           openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-cicd'
62           execution-mode: 'packaging'
63           gated-projects: 'infra/stack/kubernetes|infra/installer/kubespray'
64           successful: false
65           failed: false
66           unstable: false
67           notbuilt: false
68           deploy-scenario: 'k8-calico-nofeature'
69
70     distro:
71       - ubuntu1804
72
73     dependency-jobs: 'kubernetes-verify-tox-{stream}'
74     dependency-job-var: 'TRIGGER_kubernetes_verify_tox_{stream}_BUILD_RESULT'
75
76     jobs:
77       - 'kubernetes-verify-package-{distro}-{stream}'
78
79 - job-template:
80     name: 'kubernetes-verify-package-{distro}-{stream}'
81
82     disabled: '{obj:disabled}'
83
84     concurrent: true
85
86     parameters:
87       - string:
88           name: DEPLOY_SCENARIO
89           default: '{deploy-scenario}'
90           description: 'Scenario to test change with.'
91       - string:
92           name: EXECUTION_MODE
93           default: '{execution-mode}'
94           description: 'Engine execution mode - packaging'
95       - string:
96           name: DISTRO
97           default: '{distro}'
98           description: 'Distribution to use for configuring target nodes (networking etc.)'
99       - string:
100           name: VERBOSITY
101           default: 'true'
102           description: 'Verbosity setting for the engine - true or false - default is false'
103       - string:
104           name: CI_LOOP
105           default: 'verify'
106           description: 'CI loop type'
107       - label:
108           name: SLAVE_LABEL
109           default: 'engine-package-{distro}-fra'
110           description: 'Slave label to schedule this job on.'
111       - project-parameters:
112           project: $GERRIT_PROJECT
113           branch: '{branch}'
114           description: 'The project and branch which the change is proposed for'
115       - nordix-gerrit-parameters
116
117     properties:
118       - logrotate
119       # NOTE (fdegir): throttle categories are controlled in jenkins global configuration
120       - throttle:
121           enabled: true
122           max-per-node: 1
123           max-total: 4
124           option: category
125           categories:
126             - engine-verify-package
127
128     scm:
129       - git-scm-gerrit:
130           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
131           branch: $GERRIT_BRANCH
132           refspec: $GERRIT_REFSPEC
133           wipe_workspace: true
134           clean_before: false
135
136     triggers:
137       - gerrit:
138           server-name: 'Nordix Gerrit'
139           trigger-on:
140             - patchset-created-event:
141                 exclude-drafts: 'false'
142                 exclude-trivial-rebase: 'false'
143                 exclude-no-code-change: 'false'
144             - draft-published-event
145             - comment-added-contains-event:
146                 comment-contains-value: 'recheck'
147             - comment-added-contains-event:
148                 comment-contains-value: 'reverify'
149           projects:
150             - project-compare-type: 'REG_EXP'
151               project-pattern: '{gated-projects}'
152               branches:
153                 - branch-compare-type: 'ANT'
154                   branch-pattern: '**/{branch}'
155               disable-strict-forbidden-file-verification: 'true'
156               forbidden-file-paths:
157                 - compare-type: ANT
158                   pattern: 'docs/**|releasenotes/**'
159           skip-vote:
160             successful: '{obj:successful}'
161             failed: '{obj:failed}'
162             unstable: '{obj:unstable}'
163             notbuilt: '{obj:notbuilt}'
164           custom-url: '* $JOB_NAME $BUILD_URL'
165           readable-message: 'true'
166           dependency-jobs: '{dependency-jobs}'
167
168     wrappers:
169       - openstack:
170           single-use: True
171       - build-timeout:
172           timeout: 240
173       - credentials-binding:
174           - username-password-separated:
175               credential-id: 'nordix-cicd-arm-credentials'
176               username: NORDIX_ARM_USERNAME
177               password: NORDIX_ARM_TOKEN
178       - mask-passwords
179       - pre-scm-buildstep:
180           failOnError: true
181           buildsteps:
182             - system-groovy:
183                 command: |
184                   def build = this.getProperty('binding').getVariable('build')
185                   def listener = this.getProperty('binding').getVariable('listener')
186                   if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
187                     println "WARN  : Aborting build since dependent job did not succeed!"
188                     throw new InterruptedException()
189                   }}
190             - shell: |
191                 #!/bin/bash
192                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
193
194
195     builders:
196       - 'generate-change-metadata-macro'
197       - inject:
198           properties-file: "$WORKSPACE/change.properties"
199       - 'generate-ssh-keypair-macro'
200       - 'wait-pkg-mgr-macro'
201       - 'package-macro'
202       - 'upload-artifact-macro'