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