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