GEODE: Create CI pipeline for Nordx geode releases
[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 - parameter:
78     name: odl-gerrit-parameters
79     parameters:
80       - string:
81           name: GERRIT_USER
82           default: nordix
83           description: Non-interactive user to stream Gerrit Events on ODL Gerrit
84       - string:
85           name: GIT_BASE_HTTPS
86           default: https://git.opendaylight.org/gerrit
87           description: HTTPS URL to Project Repo on OODL Gerrit to clone repo
88       - string:
89           name: GIT_BASE_SSH
90           default: ssh://$GERRIT_USER@git.opendaylight.org:29418
91           description: SSH URL to Project Repo on ODL Gerrit to clone repo
92
93 - parameter:
94     name: opendev-gerrit-parameters
95     parameters:
96       - string:
97           name: GERRIT_USER
98           default: nordix
99           description: Non-interactive user to stream Gerrit Events on OpenDev Gerrit
100       - string:
101           name: GIT_BASE_HTTPS
102           default: https://review.opendev.org
103           description: HTTPS URL to Project Repo on OpenDev Gerrit to clone repo
104       - string:
105           name: GIT_BASE_SSH
106           default: ssh://$GERRIT_USER@review.opendev.org:29418
107           description: SSH URL to Project Repo on OpenDev Gerrit to clone repo
108
109 # defaults for job build history
110 - property:
111     name: logrotate-default
112     properties:
113       - build-discarder:
114           days-to-keep: 60
115           num-to-keep: 200
116           artifact-days-to-keep: 60
117           artifact-num-to-keep: 200
118
119 # defaults for SCM, Gerrit and GitHub
120 - scm:
121     name: git-scm
122     scm:
123       - git:
124           url: '$GIT_BASE_SSH/$PROJECT'
125           credentials-id: '{ssh-credentials-id}'
126           branches:
127             - 'refs/heads/{branch}'
128           refspec: '{refspec}'
129           timeout: 15
130           per-build-tag: false
131           skip-tag: true
132           shallow-clone: false
133           use-author: false
134           ignore-notify: false
135           wipe-workspace: '{wipe_workspace}'
136           prune: false
137           clean:
138             after: false
139             before: '{clean_before}'
140           choosing-strategy: 'default'
141
142 - scm:
143     name: git-scm-gerrit
144     scm:
145       - git:
146           url: '$GIT_BASE_SSH/$PROJECT'
147           credentials-id: '{ssh-credentials-id}'
148           branches:
149             - 'refs/heads/{branch}'
150           refspec: '{refspec}'
151           timeout: 15
152           per-build-tag: false
153           skip-tag: true
154           shallow-clone: false
155           use-author: false
156           ignore-notify: false
157           wipe-workspace: '{wipe_workspace}'
158           prune: false
159           clean:
160             after: false
161             before: '{clean_before}'
162           choosing-strategy: 'gerrit'
163
164 - scm:
165     name: git-scm-github
166     scm:
167       - git:
168           url: 'https://github.com/$PROJECT.git'
169           branches:
170             - '*/{branch}'
171           refspec: '{refspec}'
172           timeout: 15
173           per-build-tag: false
174           skip-tag: true
175           shallow-clone: false
176           use-author: false
177           ignore-notify: false
178           wipe-workspace: '{wipe_workspace}'
179           prune: false
180           clean:
181             after: false
182             before: '{clean_before}'
183           choosing-strategy: 'default'
184           basedir: '{base_dir}'
185
186 # triggers for Nordix Gerrit
187 - trigger:
188     name: nordix-gerrit-trigger-patchset-created
189     triggers:
190       - gerrit:
191           server-name: 'Nordix Gerrit'
192           trigger-on:
193             - patchset-created-event:
194                 exclude-drafts: 'false'
195                 exclude-trivial-rebase: 'false'
196                 exclude-no-code-change: 'false'
197             - draft-published-event
198             - comment-added-contains-event:
199                 comment-contains-value: 'recheck'
200             - comment-added-contains-event:
201                 comment-contains-value: 'reverify'
202           projects:
203             - project-compare-type: 'REG_EXP'
204               project-pattern: '{project}'
205               branches:
206                 - branch-compare-type: 'ANT'
207                   branch-pattern: '**/{branch}'
208               file-paths:
209                 - compare-type: 'ANT'
210                   pattern: '{files}'
211           skip-vote:
212             successful: false
213             failed: false
214             unstable: false
215             notbuilt: false
216
217 - trigger:
218     name: nordix-gerrit-trigger-change-merged
219     triggers:
220       - gerrit:
221           server-name: 'Nordix Gerrit'
222           trigger-on:
223             - change-merged-event
224             - comment-added-contains-event:
225                 comment-contains-value: 'remerge'
226           projects:
227             - project-compare-type: 'ANT'
228               project-pattern: '{project}'
229               branches:
230                 - branch-compare-type: 'ANT'
231                   branch-pattern: '**/{branch}'
232               file-paths:
233                 - compare-type: 'ANT'
234                   pattern: '{files}'
235
236 - trigger:
237     name: nordix-gerrit-push-upstream
238     triggers:
239       - gerrit:
240           server-name: 'Nordix Gerrit'
241           trigger-on:
242             - comment-added-contains-event:
243                 comment-contains-value: 'push-upstream'
244           projects:
245             - project-compare-type: 'ANT'
246               project-pattern: '{project}'
247               branches:
248                 - branch-compare-type: 'ANT'
249                   branch-pattern: '**/{branch}'
250               file-paths:
251                 - compare-type: 'ANT'
252                   pattern: '{files}'
253
254 - trigger:
255     name: nordix-gerrit-patchset-created-or-push-upstream
256     triggers:
257       - gerrit:
258           server-name: 'Nordix Gerrit'
259           trigger-on:
260             - comment-added-contains-event:
261                 comment-contains-value: 'push-upstream'
262             - patchset-created-event:
263                 exclude-drafts: true
264           projects:
265             - project-compare-type: 'ANT'
266               project-pattern: '{project}'
267               branches:
268                 - branch-compare-type: 'ANT'
269                   branch-pattern: '**/{branch}'
270               file-paths:
271                 - compare-type: 'ANT'
272                   pattern: '{files}'
273
274 # triggers for ONAP Gerrit
275 - trigger:
276     name: onap-gerrit-trigger-change-merged
277     triggers:
278       - gerrit:
279           server-name: 'ONAP Gerrit'
280           trigger-on:
281             - change-merged-event
282             - comment-added-contains-event:
283                 comment-contains-value: 'remerge'
284           projects:
285             - project-compare-type: 'ANT'
286               project-pattern: '{project}'
287               branches:
288                 - branch-compare-type: 'ANT'
289                   branch-pattern: '**/{branch}'
290               file-paths:
291                 - compare-type: 'ANT'
292                   pattern: '{files}'
293           silent: true
294           silent-start: true
295
296 # triggers for Acumos Gerrit
297 - trigger:
298     name: acumos-gerrit-trigger-change-merged
299     triggers:
300       - gerrit:
301           server-name: 'Acumos Gerrit'
302           trigger-on:
303             - change-merged-event
304             - comment-added-contains-event:
305                 comment-contains-value: 'remerge'
306           projects:
307             - project-compare-type: 'ANT'
308               project-pattern: '{project}'
309               branches:
310                 - branch-compare-type: 'ANT'
311                   branch-pattern: '**/{branch}'
312               file-paths:
313                 - compare-type: 'ANT'
314                   pattern: '{files}'
315           silent: true
316           silent-start: true
317
318 # triggers for ODL Gerrit
319 - trigger:
320     name: odl-gerrit-trigger-change-merged
321     triggers:
322       - gerrit:
323           server-name: 'ODL Gerrit'
324           trigger-on:
325             - change-merged-event
326             - comment-added-contains-event:
327                 comment-contains-value: 'remerge'
328           projects:
329             - project-compare-type: 'ANT'
330               project-pattern: '{project}'
331               branches:
332                 - branch-compare-type: 'ANT'
333                   branch-pattern: '**/{branch}'
334               file-paths:
335                 - compare-type: 'ANT'
336                   pattern: '{files}'
337           silent: true
338           silent-start: true
339
340 # triggers for OpenDev Gerrit
341 - trigger:
342     name: opendev-gerrit-trigger-change-merged
343     triggers:
344       - gerrit:
345           server-name: 'OpenDev Gerrit'
346           trigger-on:
347             - change-merged-event
348             - comment-added-contains-event:
349                 comment-contains-value: 'remerge'
350           projects:
351             - project-compare-type: 'ANT'
352               project-pattern: '{project}'
353               branches:
354                 - branch-compare-type: 'ANT'
355                   branch-pattern: '**/{branch}'
356               file-paths:
357                 - compare-type: 'ANT'
358                   pattern: '{files}'
359           silent: true
360           silent-start: true
361
362 # wrappers to use for jobs
363 - wrapper:
364     name: nordixinfra-jjb-creds-wrapper
365     wrappers:
366       - credentials-binding:
367           - username-password-separated:
368               credential-id: nordixinfra-jjb-creds
369               username: JJB_USERNAME
370               password: JJB_USERTOKEN
371
372 # timeout wrapper to use for jobs
373 - wrapper:
374     name: build-timeout
375     wrappers:
376       - timeout:
377           timeout: '{timeout}'
378           timeout-var: 'BUILD_TIMEOUT'
379           fail: true
380
381 # wrapper to fix jenkins build workspace permissions
382 - wrapper:
383     name: fix-workspace-permissions
384     wrappers:
385       - pre-scm-buildstep:
386           failOnError: true
387           buildsteps:
388             - shell: |
389                 #!/bin/bash
390                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
391
392 - publisher:
393     name: notify-slack
394     publishers:
395       - slack:
396           room: '{slack-channel}'
397           notify-failure: true
398           notify-back-to-normal: true
399
400 # property to discard old builds
401 - property:
402     name: logrotate
403     properties:
404       - build-discarder:
405           days-to-keep: 30
406           num-to-keep: 100
407           artifact-days-to-keep: 30
408           artifact-num-to-keep: 100