ONAP CPS: Separate Nordix Jenkins job to run performance 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 # Those parameters are used for ONAP java build jobs in Nordix environment.
33 - parameter:
34     name: nordix-onap-java-build-parameters
35     parameters:
36       - string:
37           name: JAVA_HOME
38           default: '/usr/lib/jvm/{jdk-version}-openjdk-amd64'
39           description: Java home
40       - string:
41           name: MVN_VERSION
42           default: '{mvn_version}'
43           description: Maven version
44       - string:
45           name: MVN_URL
46           default: https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/$MVN_VERSION/apache-maven-${{MVN_VERSION}}-bin.zip
47           description: URL to download Maven
48       - string:
49           name: MVN
50           default: $WORKSPACE/apache-maven-${{MVN_VERSION}}/bin/mvn
51           description: Path to mvn executable
52       - string:
53           name: MVN_SETTINGS_XML_VERSION
54           default: '{mvn_settings_xml_version}'
55           description: Commit ID of ONAP Oparent repository (https://git.onap.org/oparent/) to pull. Used for Maven settings file. Can be left blank to pull the latest version.
56       - string:
57           name: MVN_PARAMS
58           default: '{mvn_params}'
59           description: Maven build parameters
60       - string:
61           name: SUBDIRECTORY
62           default: '{subdirectory}'
63           description: Subdirectory of the workspace for which the pom.xml will be called. This allows the verify to be called against a specific directory
64
65 - parameter:
66     name: onap-gerrit-parameters
67     parameters:
68       - string:
69           name: GERRIT_USER
70           default: nordix
71           description: Non-interactive user to stream Gerrit Events on ONAP Gerrit
72       - string:
73           name: GIT_BASE_HTTPS
74           default: https://gerrit.onap.org/r/p
75           description: HTTPS URL to Project Repo on ONAP Gerrit to clone repo
76       - string:
77           name: GIT_BASE_SSH
78           default: ssh://$GERRIT_USER@gerrit.onap.org:29418
79           description: SSH URL to Project Repo on ONAP Gerrit to clone repo
80
81 - parameter:
82     name: acumos-gerrit-parameters
83     parameters:
84       - string:
85           name: GERRIT_USER
86           default: nordix
87           description: Non-interactive user to stream Gerrit Events on Acumos Gerrit
88       - string:
89           name: GIT_BASE_HTTPS
90           default: https://gerrit.acumos.org/r/p
91           description: HTTPS URL to Project Repo on Acumos Gerrit to clone repo
92       - string:
93           name: GIT_BASE_SSH
94           default: ssh://$GERRIT_USER@gerrit.acumos.org:29418
95           description: SSH URL to Project Repo on Acumos Gerrit to clone repo
96
97 - parameter:
98     name: odl-gerrit-parameters
99     parameters:
100       - string:
101           name: GERRIT_USER
102           default: nordix
103           description: Non-interactive user to stream Gerrit Events on ODL Gerrit
104       - string:
105           name: GIT_BASE_HTTPS
106           default: https://git.opendaylight.org/gerrit
107           description: HTTPS URL to Project Repo on OODL Gerrit to clone repo
108       - string:
109           name: GIT_BASE_SSH
110           default: ssh://$GERRIT_USER@git.opendaylight.org:29418
111           description: SSH URL to Project Repo on ODL Gerrit to clone repo
112
113 - parameter:
114     name: opendev-gerrit-parameters
115     parameters:
116       - string:
117           name: GERRIT_USER
118           default: nordix
119           description: Non-interactive user to stream Gerrit Events on OpenDev Gerrit
120       - string:
121           name: GIT_BASE_HTTPS
122           default: https://review.opendev.org
123           description: HTTPS URL to Project Repo on OpenDev Gerrit to clone repo
124       - string:
125           name: GIT_BASE_SSH
126           default: ssh://$GERRIT_USER@review.opendev.org:29418
127           description: SSH URL to Project Repo on OpenDev Gerrit to clone repo
128
129 - parameter:
130     name: oransc-gerrit-parameters
131     parameters:
132       - string:
133           name: GERRIT_USER
134           default: nordix
135           description: Non-interactive user to stream Gerrit Events on ORAN-SC Gerrit
136       - string:
137           name: GIT_BASE_HTTPS
138           default: https://gerrit.o-ran-sc.org/r
139           description: HTTPS URL to Project Repo on ORAN-SC Gerrit to clone repo
140       - string:
141           name: GIT_BASE_SSH
142           default: ssh://$GERRIT_USER@gerrit.o-ran-sc.org:29418
143           description: SSH URL to Project Repo on ORAN-SC Gerrit to clone repo
144
145 - parameter:
146     name: fdio-gerrit-parameters
147     parameters:
148       - string:
149           name: GERRIT_USER
150           default: nordix
151           description: Non-interactive user to stream Gerrit Events on Fast Data Project Gerrit
152       - string:
153           name: GIT_BASE_HTTPS
154           default: https://gerrit.fd.io/r
155           description: HTTPS URL to Project Repo on Fast Data Project Gerrit to clone repo
156       - string:
157           name: GIT_BASE_SSH
158           default: ssh://$GERRIT_USER@gerrit.fd.io:29418
159           description: SSH URL to Project Repo on Fast Data Project Gerrit to clone repo
160
161 # Verify job for Geode git tags to make sure there are in agreed format
162 - builder:
163     name: 'verify-geode-tag-macro'
164     builders:
165       - shell:
166           !include-raw: ./verify_geode_tag.sh
167
168 - builder:
169     name: 'wait-pkg-mgr-macro'
170     builders:
171       - shell:
172           !include-raw: ./scripts/wait-for-pkg-manager.sh
173
174 # defaults for job build history
175 - property:
176     name: logrotate-default
177     properties:
178       - build-discarder:
179           days-to-keep: 60
180           num-to-keep: 200
181           artifact-days-to-keep: 60
182           artifact-num-to-keep: 200
183
184 # defaults for SCM, Gerrit and GitHub
185 - scm:
186     name: git-scm
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: 'default'
206
207 - scm:
208     name: git-scm-gerrit
209     scm:
210       - git:
211           url: '$GIT_BASE_SSH/$PROJECT'
212           credentials-id: '{ssh-credentials-id}'
213           branches:
214             - 'refs/heads/{branch}'
215           refspec: '{refspec}'
216           timeout: 15
217           per-build-tag: false
218           skip-tag: true
219           shallow-clone: false
220           use-author: false
221           ignore-notify: false
222           wipe-workspace: '{wipe_workspace}'
223           prune: false
224           clean:
225             after: false
226             before: '{clean_before}'
227           choosing-strategy: 'gerrit'
228
229 - scm:
230     name: git-scm-github
231     scm:
232       - git:
233           url: 'https://github.com/$PROJECT.git'
234           branches:
235             - '*/{branch}'
236           refspec: '{refspec}'
237           timeout: 15
238           per-build-tag: false
239           skip-tag: true
240           shallow-clone: false
241           use-author: false
242           ignore-notify: false
243           wipe-workspace: '{wipe_workspace}'
244           prune: false
245           clean:
246             after: false
247             before: '{clean_before}'
248           choosing-strategy: 'default'
249           basedir: '{base_dir}'
250
251 # triggers for Nordix Gerrit
252 - trigger:
253     name: nordix-gerrit-trigger-patchset-created
254     triggers:
255       - gerrit:
256           server-name: 'Nordix Gerrit'
257           trigger-on:
258             - patchset-created-event:
259                 exclude-drafts: 'false'
260                 exclude-trivial-rebase: 'false'
261                 exclude-no-code-change: 'false'
262             - draft-published-event
263             - comment-added-contains-event:
264                 comment-contains-value: 'recheck'
265             - comment-added-contains-event:
266                 comment-contains-value: 'reverify'
267           projects:
268             - project-compare-type: 'REG_EXP'
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           skip-vote:
277             successful: false
278             failed: false
279             unstable: false
280             notbuilt: false
281
282 - trigger:
283     name: nordix-gerrit-trigger-change-merged
284     triggers:
285       - gerrit:
286           server-name: 'Nordix Gerrit'
287           trigger-on:
288             - change-merged-event
289             - comment-added-contains-event:
290                 comment-contains-value: 'remerge'
291           projects:
292             - project-compare-type: 'ANT'
293               project-pattern: '{project}'
294               branches:
295                 - branch-compare-type: 'ANT'
296                   branch-pattern: '**/{branch}'
297               file-paths:
298                 - compare-type: 'ANT'
299                   pattern: '{files}'
300
301 - trigger:
302     name: nordix-gerrit-push-upstream
303     triggers:
304       - gerrit:
305           server-name: 'Nordix Gerrit'
306           trigger-on:
307             - comment-added-contains-event:
308                 comment-contains-value: 'push-upstream'
309           projects:
310             - project-compare-type: 'ANT'
311               project-pattern: '{project}'
312               branches:
313                 - branch-compare-type: 'ANT'
314                   branch-pattern: '**/{branch}'
315               file-paths:
316                 - compare-type: 'ANT'
317                   pattern: '{files}'
318
319 - trigger:
320     name: nordix-gerrit-patchset-created-or-push-upstream
321     triggers:
322       - gerrit:
323           server-name: 'Nordix Gerrit'
324           trigger-on:
325             - comment-added-contains-event:
326                 comment-contains-value: 'push-upstream'
327             - patchset-created-event:
328                 exclude-drafts: true
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
339 # triggers for ONAP Gerrit
340 - trigger:
341     name: onap-gerrit-trigger-change-merged
342     triggers:
343       - gerrit:
344           server-name: 'ONAP 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 Acumos Gerrit
362 - trigger:
363     name: acumos-gerrit-trigger-change-merged
364     triggers:
365       - gerrit:
366           server-name: 'Acumos 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 ODL Gerrit
384 - trigger:
385     name: odl-gerrit-trigger-change-merged
386     triggers:
387       - gerrit:
388           server-name: 'ODL 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 OpenDev Gerrit
406 - trigger:
407     name: opendev-gerrit-trigger-change-merged
408     triggers:
409       - gerrit:
410           server-name: 'OpenDev 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 ORANSC Gerrit
428 - trigger:
429     name: oransc-gerrit-trigger-change-merged
430     triggers:
431       - gerrit:
432           server-name: 'ORANSC 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 # triggers for Fast Data Project Gerrit
450 - trigger:
451     name: fdio-gerrit-trigger-change-merged
452     triggers:
453       - gerrit:
454           server-name: 'FDio Gerrit'
455           trigger-on:
456             - change-merged-event
457             - comment-added-contains-event:
458                 comment-contains-value: 'remerge'
459           projects:
460             - project-compare-type: 'ANT'
461               project-pattern: '{project}'
462               branches:
463                 - branch-compare-type: 'ANT'
464                   branch-pattern: '**/{branch}'
465               file-paths:
466                 - compare-type: 'ANT'
467                   pattern: '{files}'
468           silent: true
469           silent-start: true
470
471 # wrappers to use for jobs
472 - wrapper:
473     name: nordixinfra-jjb-creds-wrapper
474     wrappers:
475       - credentials-binding:
476           - username-password-separated:
477               credential-id: nordixinfra-jjb-creds
478               username: JJB_USERNAME
479               password: JJB_USERTOKEN
480
481 # wrappers to use for jobs
482 - wrapper:
483     name: nordixinfra-harbor-creds-wrapper
484     wrappers:
485       - credentials-binding:
486           - username-password-separated:
487               credential-id: nordix-cicd-harbor-credentials
488               username: HARBOR_USERNAME
489               password: HARBOR_PASSWORD
490
491 # wrappers to use for jobs
492 - wrapper:
493     name: nordixinfra-eiffel-github-token
494     wrappers:
495       - credentials-binding:
496           - username-password-separated:
497               credential-id: nordixinfra-eiffel-username-personal-access-token
498               username: NORDIXINFRA_GITHUB_USERNAME
499               password: NORDIXINFRA_GITHUB_TOKEN
500
501 # wrappers to use for jobs
502 - wrapper:
503     name: nordix-gerrit-http-api-token
504     wrappers:
505       - credentials-binding:
506           - username-password-separated:
507               credential-id: nordixinfra-nordix-gerrit-http-api-token
508               username: GERRIT_USER
509               password: GERRIT_API_KEY
510
511 # timeout wrapper to use for jobs
512 - wrapper:
513     name: build-timeout
514     wrappers:
515       - timeout:
516           timeout: '{timeout}'
517           timeout-var: 'BUILD_TIMEOUT'
518           fail: true
519
520 # wrapper to fix jenkins build workspace permissions
521 - wrapper:
522     name: fix-workspace-permissions
523     wrappers:
524       - pre-scm-buildstep:
525           failOnError: true
526           buildsteps:
527             - shell: |
528                 #!/bin/bash
529                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
530
531 - publisher:
532     name: notify-slack
533     publishers:
534       - slack:
535           room: '{slack-channel}'
536           notify-start: '{notify-start}'
537           notify-success: '{notify-success}'
538           notify-failure: '{notify-failure}'
539           notify-back-to-normal: '{notify-back-to-normal}'
540
541 # property to discard old builds
542 - property:
543     name: logrotate
544     properties:
545       - build-discarder:
546           days-to-keep: 30
547           num-to-keep: 100
548           artifact-days-to-keep: 30
549           artifact-num-to-keep: 100
550
551 - property:
552     name: est-ms-teams-rebase-jobs-webhook
553     properties:
554       - office-365-connector:
555             webhooks:
556               - url: "${EST_MS_TEAMS_NORDIX_REBASE_JOBS_WEBHOOK}"
557                 name: full
558                 start-notification: true
559                 notify-success: true
560                 notify-aborted: true
561                 notify-not-built: true
562                 notify-unstable: true
563                 notify-failure: true
564                 notify-back-to-normal: true
565                 notify-repeated-failure: true