ONAP: Updata java version SDC project, new jjb repo
[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://opendev.org/jjb/jenkins-job-builder.git
9           description: OpenDev JJB repo
10       - string:
11           name: JJB_VERSION
12           default: 2.9.1
13           description: OpenDev JJB version to install - matches to LFN JJB version
14       - string:
15           name: NORDIX_REGISTRY
16           default: registry.nordix.org
17           description: Nordix Container Image Registry
18
19 # these parameters are used for setting the Gerrit Project on Nordix
20 - parameter:
21     name: project-parameters
22     parameters:
23       - string:
24           name: PROJECT
25           default: '{project}'
26           description: JJB configured PROJECT parameter to identify a Nordix Gerrit project
27       - string:
28           name: BRANCH
29           default: '{branch}'
30           description: "JJB configured BRANCH parameter (e.g. master, nordix-dev)"
31
32 # these parameters are used for streaming changes from various Gerrit Systems
33 - parameter:
34     name: nordix-gerrit-parameters
35     parameters:
36       - string:
37           name: GERRIT_USER
38           default: infra
39           description: Non-interactive user to stream Gerrit Events on Nordix Gerrit
40       - string:
41           name: GIT_BASE_HTTPS
42           default: https://gerrit.nordix.org
43           description: HTTPS URL of Project Repo on Nordix Gerrit to clone repo
44       - string:
45           name: GIT_BASE_SSH
46           default: ssh://$GERRIT_USER@gerrit.nordix.org:29418
47           description: HTTPS URL of Project Repo on Nordix Gerrit to clone repo
48
49 - parameter:
50     name: onap-gerrit-parameters
51     parameters:
52       - string:
53           name: GERRIT_USER
54           default: nordix
55           description: Non-interactive user to stream Gerrit Events on ONAP Gerrit
56       - string:
57           name: GIT_BASE_HTTPS
58           default: https://gerrit.onap.org/r/p
59           description: HTTPS URL to Project Repo on ONAP Gerrit to clone repo
60       - string:
61           name: GIT_BASE_SSH
62           default: ssh://$GERRIT_USER@gerrit.onap.org:29418
63           description: SSH URL to Project Repo on ONAP Gerrit to clone repo
64
65 - parameter:
66     name: acumos-gerrit-parameters
67     parameters:
68       - string:
69           name: GERRIT_USER
70           default: nordix
71           description: Non-interactive user to stream Gerrit Events on Acumos Gerrit
72       - string:
73           name: GIT_BASE_HTTPS
74           default: https://gerrit.acumos.org/r/p
75           description: HTTPS URL to Project Repo on Acumos Gerrit to clone repo
76       - string:
77           name: GIT_BASE_SSH
78           default: ssh://$GERRIT_USER@gerrit.acumos.org:29418
79           description: SSH URL to Project Repo on Acumos Gerrit to clone repo
80
81 - parameter:
82     name: odl-gerrit-parameters
83     parameters:
84       - string:
85           name: GERRIT_USER
86           default: nordix
87           description: Non-interactive user to stream Gerrit Events on ODL Gerrit
88       - string:
89           name: GIT_BASE_HTTPS
90           default: https://git.opendaylight.org/gerrit
91           description: HTTPS URL to Project Repo on OODL Gerrit to clone repo
92       - string:
93           name: GIT_BASE_SSH
94           default: ssh://$GERRIT_USER@git.opendaylight.org:29418
95           description: SSH URL to Project Repo on ODL Gerrit to clone repo
96
97 - parameter:
98     name: opendev-gerrit-parameters
99     parameters:
100       - string:
101           name: GERRIT_USER
102           default: nordix
103           description: Non-interactive user to stream Gerrit Events on OpenDev Gerrit
104       - string:
105           name: GIT_BASE_HTTPS
106           default: https://review.opendev.org
107           description: HTTPS URL to Project Repo on OpenDev Gerrit to clone repo
108       - string:
109           name: GIT_BASE_SSH
110           default: ssh://$GERRIT_USER@review.opendev.org:29418
111           description: SSH URL to Project Repo on OpenDev Gerrit to clone repo
112
113 - parameter:
114     name: oransc-gerrit-parameters
115     parameters:
116       - string:
117           name: GERRIT_USER
118           default: nordix
119           description: Non-interactive user to stream Gerrit Events on ORAN-SC Gerrit
120       - string:
121           name: GIT_BASE_HTTPS
122           default: https://gerrit.o-ran-sc.org/r
123           description: HTTPS URL to Project Repo on ORAN-SC Gerrit to clone repo
124       - string:
125           name: GIT_BASE_SSH
126           default: ssh://$GERRIT_USER@gerrit.o-ran-sc.org:29418
127           description: SSH URL to Project Repo on ORAN-SC Gerrit to clone repo
128
129 - parameter:
130     name: fdio-gerrit-parameters
131     parameters:
132       - string:
133           name: GERRIT_USER
134           default: nordix
135           description: Non-interactive user to stream Gerrit Events on Fast Data Project Gerrit
136       - string:
137           name: GIT_BASE_HTTPS
138           default: https://gerrit.fd.io/r
139           description: HTTPS URL to Project Repo on Fast Data Project Gerrit to clone repo
140       - string:
141           name: GIT_BASE_SSH
142           default: ssh://$GERRIT_USER@gerrit.fd.io:29418
143           description: SSH URL to Project Repo on Fast Data Project Gerrit to clone repo
144
145 # Verify job for Geode git tags to make sure there are in agreed format
146 - builder:
147     name: 'verify-geode-tag-macro'
148     builders:
149       - shell:
150           !include-raw: ./verify_geode_tag.sh
151
152 # defaults for job build history
153 - property:
154     name: logrotate-default
155     properties:
156       - build-discarder:
157           days-to-keep: 60
158           num-to-keep: 200
159           artifact-days-to-keep: 60
160           artifact-num-to-keep: 200
161
162 # defaults for SCM, Gerrit and GitHub
163 - scm:
164     name: git-scm
165     scm:
166       - git:
167           url: '$GIT_BASE_SSH/$PROJECT'
168           credentials-id: '{ssh-credentials-id}'
169           branches:
170             - 'refs/heads/{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
185 - scm:
186     name: git-scm-gerrit
187     scm:
188       - git:
189           url: '$GIT_BASE_SSH/$PROJECT'
190           credentials-id: '{ssh-credentials-id}'
191           branches:
192             - 'refs/heads/{branch}'
193           refspec: '{refspec}'
194           timeout: 15
195           per-build-tag: false
196           skip-tag: true
197           shallow-clone: false
198           use-author: false
199           ignore-notify: false
200           wipe-workspace: '{wipe_workspace}'
201           prune: false
202           clean:
203             after: false
204             before: '{clean_before}'
205           choosing-strategy: 'gerrit'
206
207 - scm:
208     name: git-scm-github
209     scm:
210       - git:
211           url: 'https://github.com/$PROJECT.git'
212           branches:
213             - '*/{branch}'
214           refspec: '{refspec}'
215           timeout: 15
216           per-build-tag: false
217           skip-tag: true
218           shallow-clone: false
219           use-author: false
220           ignore-notify: false
221           wipe-workspace: '{wipe_workspace}'
222           prune: false
223           clean:
224             after: false
225             before: '{clean_before}'
226           choosing-strategy: 'default'
227           basedir: '{base_dir}'
228
229 # triggers for Nordix Gerrit
230 - trigger:
231     name: nordix-gerrit-trigger-patchset-created
232     triggers:
233       - gerrit:
234           server-name: 'Nordix Gerrit'
235           trigger-on:
236             - patchset-created-event:
237                 exclude-drafts: 'false'
238                 exclude-trivial-rebase: 'false'
239                 exclude-no-code-change: 'false'
240             - draft-published-event
241             - comment-added-contains-event:
242                 comment-contains-value: 'recheck'
243             - comment-added-contains-event:
244                 comment-contains-value: 'reverify'
245           projects:
246             - project-compare-type: 'REG_EXP'
247               project-pattern: '{project}'
248               branches:
249                 - branch-compare-type: 'ANT'
250                   branch-pattern: '**/{branch}'
251               file-paths:
252                 - compare-type: 'ANT'
253                   pattern: '{files}'
254           skip-vote:
255             successful: false
256             failed: false
257             unstable: false
258             notbuilt: false
259
260 - trigger:
261     name: nordix-gerrit-trigger-change-merged
262     triggers:
263       - gerrit:
264           server-name: 'Nordix Gerrit'
265           trigger-on:
266             - change-merged-event
267             - comment-added-contains-event:
268                 comment-contains-value: 'remerge'
269           projects:
270             - project-compare-type: 'ANT'
271               project-pattern: '{project}'
272               branches:
273                 - branch-compare-type: 'ANT'
274                   branch-pattern: '**/{branch}'
275               file-paths:
276                 - compare-type: 'ANT'
277                   pattern: '{files}'
278
279 - trigger:
280     name: nordix-gerrit-push-upstream
281     triggers:
282       - gerrit:
283           server-name: 'Nordix Gerrit'
284           trigger-on:
285             - comment-added-contains-event:
286                 comment-contains-value: 'push-upstream'
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 - trigger:
298     name: nordix-gerrit-patchset-created-or-push-upstream
299     triggers:
300       - gerrit:
301           server-name: 'Nordix Gerrit'
302           trigger-on:
303             - comment-added-contains-event:
304                 comment-contains-value: 'push-upstream'
305             - patchset-created-event:
306                 exclude-drafts: true
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
317 # triggers for ONAP Gerrit
318 - trigger:
319     name: onap-gerrit-trigger-change-merged
320     triggers:
321       - gerrit:
322           server-name: 'ONAP Gerrit'
323           trigger-on:
324             - change-merged-event
325             - comment-added-contains-event:
326                 comment-contains-value: 'remerge'
327           projects:
328             - project-compare-type: 'ANT'
329               project-pattern: '{project}'
330               branches:
331                 - branch-compare-type: 'ANT'
332                   branch-pattern: '**/{branch}'
333               file-paths:
334                 - compare-type: 'ANT'
335                   pattern: '{files}'
336           silent: true
337           silent-start: true
338
339 # triggers for Acumos Gerrit
340 - trigger:
341     name: acumos-gerrit-trigger-change-merged
342     triggers:
343       - gerrit:
344           server-name: 'Acumos Gerrit'
345           trigger-on:
346             - change-merged-event
347             - comment-added-contains-event:
348                 comment-contains-value: 'remerge'
349           projects:
350             - project-compare-type: 'ANT'
351               project-pattern: '{project}'
352               branches:
353                 - branch-compare-type: 'ANT'
354                   branch-pattern: '**/{branch}'
355               file-paths:
356                 - compare-type: 'ANT'
357                   pattern: '{files}'
358           silent: true
359           silent-start: true
360
361 # triggers for ODL Gerrit
362 - trigger:
363     name: odl-gerrit-trigger-change-merged
364     triggers:
365       - gerrit:
366           server-name: 'ODL Gerrit'
367           trigger-on:
368             - change-merged-event
369             - comment-added-contains-event:
370                 comment-contains-value: 'remerge'
371           projects:
372             - project-compare-type: 'ANT'
373               project-pattern: '{project}'
374               branches:
375                 - branch-compare-type: 'ANT'
376                   branch-pattern: '**/{branch}'
377               file-paths:
378                 - compare-type: 'ANT'
379                   pattern: '{files}'
380           silent: true
381           silent-start: true
382
383 # triggers for OpenDev Gerrit
384 - trigger:
385     name: opendev-gerrit-trigger-change-merged
386     triggers:
387       - gerrit:
388           server-name: 'OpenDev Gerrit'
389           trigger-on:
390             - change-merged-event
391             - comment-added-contains-event:
392                 comment-contains-value: 'remerge'
393           projects:
394             - project-compare-type: 'ANT'
395               project-pattern: '{project}'
396               branches:
397                 - branch-compare-type: 'ANT'
398                   branch-pattern: '**/{branch}'
399               file-paths:
400                 - compare-type: 'ANT'
401                   pattern: '{files}'
402           silent: true
403           silent-start: true
404
405 # triggers for ORANSC Gerrit
406 - trigger:
407     name: oransc-gerrit-trigger-change-merged
408     triggers:
409       - gerrit:
410           server-name: 'ORANSC Gerrit'
411           trigger-on:
412             - change-merged-event
413             - comment-added-contains-event:
414                 comment-contains-value: 'remerge'
415           projects:
416             - project-compare-type: 'ANT'
417               project-pattern: '{project}'
418               branches:
419                 - branch-compare-type: 'ANT'
420                   branch-pattern: '**/{branch}'
421               file-paths:
422                 - compare-type: 'ANT'
423                   pattern: '{files}'
424           silent: true
425           silent-start: true
426
427 # triggers for Fast Data Project Gerrit
428 - trigger:
429     name: fdio-gerrit-trigger-change-merged
430     triggers:
431       - gerrit:
432           server-name: 'FDio Gerrit'
433           trigger-on:
434             - change-merged-event
435             - comment-added-contains-event:
436                 comment-contains-value: 'remerge'
437           projects:
438             - project-compare-type: 'ANT'
439               project-pattern: '{project}'
440               branches:
441                 - branch-compare-type: 'ANT'
442                   branch-pattern: '**/{branch}'
443               file-paths:
444                 - compare-type: 'ANT'
445                   pattern: '{files}'
446           silent: true
447           silent-start: true
448
449 # wrappers to use for jobs
450 - wrapper:
451     name: nordixinfra-jjb-creds-wrapper
452     wrappers:
453       - credentials-binding:
454           - username-password-separated:
455               credential-id: nordixinfra-jjb-creds
456               username: JJB_USERNAME
457               password: JJB_USERTOKEN
458
459 # wrappers to use for jobs
460 - wrapper:
461     name: nordixinfra-harbor-creds-wrapper
462     wrappers:
463       - credentials-binding:
464           - username-password-separated:
465               credential-id: nordix-cicd-harbor-credentials
466               username: HARBOR_USERNAME
467               password: HARBOR_PASSWORD
468
469 # timeout wrapper to use for jobs
470 - wrapper:
471     name: build-timeout
472     wrappers:
473       - timeout:
474           timeout: '{timeout}'
475           timeout-var: 'BUILD_TIMEOUT'
476           fail: true
477
478 # wrapper to fix jenkins build workspace permissions
479 - wrapper:
480     name: fix-workspace-permissions
481     wrappers:
482       - pre-scm-buildstep:
483           failOnError: true
484           buildsteps:
485             - shell: |
486                 #!/bin/bash
487                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
488
489 - publisher:
490     name: notify-slack
491     publishers:
492       - slack:
493           room: '{slack-channel}'
494           notify-start: '{notify-start}'
495           notify-success: '{notify-success}'
496           notify-failure: '{notify-failure}'
497           notify-back-to-normal: '{notify-back-to-normal}'
498
499 # property to discard old builds
500 - property:
501     name: logrotate
502     properties:
503       - build-discarder:
504           days-to-keep: 30
505           num-to-keep: 100
506           artifact-days-to-keep: 30
507           artifact-num-to-keep: 100