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