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