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