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