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