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