Merge "Acumos: Add jobs for acumos-java-client project"
[infra/cicd.git] / jjb / global / jjb-macros.yaml
1 ---
2 # these parameters are used for infra related variables
3 - parameter:
4     name: infra-parameters
5     parameters:
6       - string:
7           name: JJB_GIT_REPO
8           default: https://git.openstack.org/openstack-infra/jenkins-job-builder
9           description: OpenStack JJB repo
10       - string:
11           name: JJB_VERSION
12           default: 2.9.1
13           description: OpenStack JJB version to install - matches to LFN JJB version
14
15 # these parameters are used for setting the Gerrit Project on Nordix
16 - parameter:
17     name: project-parameters
18     parameters:
19       - string:
20           name: PROJECT
21           default: '{project}'
22           description: JJB configured PROJECT parameter to identify a Nordix Gerrit project
23       - string:
24           name: BRANCH
25           default: '{branch}'
26           description: "JJB configured BRANCH parameter (e.g. master, nordix-dev)"
27
28 # these parameters are used for streaming changes from various Gerrit Systems
29 - parameter:
30     name: nordix-gerrit-parameters
31     parameters:
32       - string:
33           name: GERRIT_USER
34           default: infra
35           description: Non-interactive user to stream Gerrit Events on Nordix Gerrit
36       - string:
37           name: GIT_BASE_HTTPS
38           default: https://gerrit.nordix.org
39           description: HTTPS URL of Project Repo on Nordix Gerrit to clone repo
40       - string:
41           name: GIT_BASE_SSH
42           default: ssh://$GERRIT_USER@gerrit.nordix.org:29418
43           description: HTTPS URL of Project Repo on Nordix Gerrit to clone repo
44
45 - parameter:
46     name: onap-gerrit-parameters
47     parameters:
48       - string:
49           name: GERRIT_USER
50           default: nordix
51           description: Non-interactive user to stream Gerrit Events on ONAP Gerrit
52       - string:
53           name: GIT_BASE_HTTPS
54           default: https://gerrit.onap.org/r/p
55           description: HTTPS URL to Project Repo on ONAP Gerrit to clone repo
56       - string:
57           name: GIT_BASE_SSH
58           default: ssh://$GERRIT_USER@gerrit.onap.org:29418
59           description: SSH URL to Project Repo on ONAP Gerrit to clone repo
60
61 - parameter:
62     name: acumos-gerrit-parameters
63     parameters:
64       - string:
65           name: GERRIT_USER
66           default: nordix
67           description: Non-interactive user to stream Gerrit Events on Acumos Gerrit
68       - string:
69           name: GIT_BASE_HTTPS
70           default: https://gerrit.acumos.org/r/p
71           description: HTTPS URL to Project Repo on Acumos Gerrit to clone repo
72       - string:
73           name: GIT_BASE_SSH
74           default: ssh://$GERRIT_USER@gerrit.acumos.org:29418
75           description: SSH URL to Project Repo on Acumos Gerrit to clone repo
76
77 # defaults for job build history
78 - property:
79     name: logrotate-default
80     properties:
81       - build-discarder:
82           days-to-keep: 60
83           num-to-keep: 200
84           artifact-days-to-keep: 60
85           artifact-num-to-keep: 200
86
87 # defaults for SCM and Gerrit
88 - scm:
89     name: git-scm
90     scm:
91       - git:
92           url: '$GIT_BASE_SSH/$PROJECT'
93           credentials-id: '{ssh-credentials-id}'
94           branches:
95             - 'refs/heads/{branch}'
96           refspec: '{refspec}'
97           timeout: 15
98           per-build-tag: false
99           skip-tag: true
100           shallow-clone: false
101           use-author: false
102           ignore-notify: false
103           wipe-workspace: true
104           prune: false
105           choosing-strategy: 'default'
106
107 - scm:
108     name: git-scm-gerrit
109     scm:
110       - git:
111           url: '$GIT_BASE_SSH/$PROJECT'
112           credentials-id: '{ssh-credentials-id}'
113           branches:
114             - 'refs/heads/{branch}'
115           refspec: '{refspec}'
116           timeout: 15
117           per-build-tag: false
118           skip-tag: true
119           shallow-clone: false
120           use-author: false
121           ignore-notify: false
122           wipe-workspace: true
123           prune: false
124           choosing-strategy: 'gerrit'
125
126 # triggers for Nordix Gerrit
127 - trigger:
128     name: nordix-gerrit-trigger-patchset-created
129     triggers:
130       - gerrit:
131           server-name: 'Nordix Gerrit'
132           trigger-on:
133             - patchset-created-event:
134                 exclude-drafts: 'false'
135                 exclude-trivial-rebase: 'false'
136                 exclude-no-code-change: 'false'
137             - draft-published-event
138             - comment-added-contains-event:
139                 comment-contains-value: 'recheck'
140             - comment-added-contains-event:
141                 comment-contains-value: 'reverify'
142           projects:
143             - project-compare-type: 'REG_EXP'
144               project-pattern: '{project}'
145               branches:
146                 - branch-compare-type: 'ANT'
147                   branch-pattern: '**/{branch}'
148               file-paths:
149                 - compare-type: 'ANT'
150                   pattern: '{files}'
151
152 - trigger:
153     name: nordix-gerrit-trigger-change-merged
154     triggers:
155       - gerrit:
156           server-name: 'Nordix Gerrit'
157           trigger-on:
158             - change-merged-event
159             - comment-added-contains-event:
160                 comment-contains-value: 'remerge'
161           projects:
162             - project-compare-type: 'ANT'
163               project-pattern: '{project}'
164               branches:
165                 - branch-compare-type: 'ANT'
166                   branch-pattern: '**/{branch}'
167               file-paths:
168                 - compare-type: 'ANT'
169                   pattern: '{files}'
170
171 - trigger:
172     name: nordix-gerrit-push-upstream
173     triggers:
174       - gerrit:
175           server-name: 'Nordix Gerrit'
176           trigger-on:
177             - comment-added-contains-event:
178                 comment-contains-value: 'push-upstream'
179           projects:
180             - project-compare-type: 'ANT'
181               project-pattern: '{project}'
182               branches:
183                 - branch-compare-type: 'ANT'
184                   branch-pattern: '**/{branch}'
185               file-paths:
186                 - compare-type: 'ANT'
187                   pattern: '{files}'
188
189 # triggers for ONAP Gerrit
190 - trigger:
191     name: onap-gerrit-trigger-change-merged
192     triggers:
193       - gerrit:
194           server-name: 'ONAP Gerrit'
195           trigger-on:
196             - change-merged-event
197             - comment-added-contains-event:
198                 comment-contains-value: 'remerge'
199           projects:
200             - project-compare-type: 'ANT'
201               project-pattern: '{project}'
202               branches:
203                 - branch-compare-type: 'ANT'
204                   branch-pattern: '**/{branch}'
205               file-paths:
206                 - compare-type: 'ANT'
207                   pattern: '{files}'
208           silent: true
209           silent-start: true
210
211 # triggers for Acumos Gerrit
212 - trigger:
213     name: acumos-gerrit-trigger-change-merged
214     triggers:
215       - gerrit:
216           server-name: 'Acumos Gerrit'
217           trigger-on:
218             - change-merged-event
219             - comment-added-contains-event:
220                 comment-contains-value: 'remerge'
221           projects:
222             - project-compare-type: 'ANT'
223               project-pattern: '{project}'
224               branches:
225                 - branch-compare-type: 'ANT'
226                   branch-pattern: '**/{branch}'
227               file-paths:
228                 - compare-type: 'ANT'
229                   pattern: '{files}'
230           silent: true
231           silent-start: true
232
233
234 # wrappers to use for jobs
235 - wrapper:
236     name: nordixinfra-jjb-creds-wrapper
237     wrappers:
238       - credentials-binding:
239           - username-password-separated:
240               credential-id: nordixinfra-jjb-creds
241               username: JJB_USERNAME
242               password: JJB_USERTOKEN
243
244 # timeout wrapper to use for jobs
245 - wrapper:
246     name: build-timeout
247     wrappers:
248       - timeout:
249           timeout: '{timeout}'
250           timeout-var: 'BUILD_TIMEOUT'
251           fail: true
252
253 # wrapper to fix jenkins build workspace permissions
254 - wrapper:
255     name: fix-workspace-permissions
256     wrappers:
257       - pre-scm-buildstep:
258           failOnError: true
259           buildsteps:
260             - shell: |
261                 #!/bin/bash
262                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
263
264 - publisher:
265     name: notify-slack
266     publishers:
267       - slack:
268           room: '{slack-channel}'
269           notify-failure: True
270
271 # property to discard old builds
272 - property:
273     name: logrotate
274     properties:
275       - build-discarder:
276           days-to-keep: 30
277           num-to-keep: 100
278           artifact-days-to-keep: 30
279           artifact-num-to-keep: 100