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