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