Addd ODL Gerrit parameters to global jjb macros
[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://git.openstack.org/openstack-infra/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 # defaults for job build history
94 - property:
95     name: logrotate-default
96     properties:
97       - build-discarder:
98           days-to-keep: 60
99           num-to-keep: 200
100           artifact-days-to-keep: 60
101           artifact-num-to-keep: 200
102
103 # defaults for SCM and Gerrit
104 - scm:
105     name: git-scm
106     scm:
107       - git:
108           url: '$GIT_BASE_SSH/$PROJECT'
109           credentials-id: '{ssh-credentials-id}'
110           branches:
111             - 'refs/heads/{branch}'
112           refspec: '{refspec}'
113           timeout: 15
114           per-build-tag: false
115           skip-tag: true
116           shallow-clone: false
117           use-author: false
118           ignore-notify: false
119           wipe-workspace: true
120           prune: false
121           choosing-strategy: 'default'
122
123 - scm:
124     name: git-scm-gerrit
125     scm:
126       - git:
127           url: '$GIT_BASE_SSH/$PROJECT'
128           credentials-id: '{ssh-credentials-id}'
129           branches:
130             - 'refs/heads/{branch}'
131           refspec: '{refspec}'
132           timeout: 15
133           per-build-tag: false
134           skip-tag: true
135           shallow-clone: false
136           use-author: false
137           ignore-notify: false
138           wipe-workspace: true
139           prune: false
140           choosing-strategy: 'gerrit'
141
142 # triggers for Nordix Gerrit
143 - trigger:
144     name: nordix-gerrit-trigger-patchset-created
145     triggers:
146       - gerrit:
147           server-name: 'Nordix Gerrit'
148           trigger-on:
149             - patchset-created-event:
150                 exclude-drafts: 'false'
151                 exclude-trivial-rebase: 'false'
152                 exclude-no-code-change: 'false'
153             - draft-published-event
154             - comment-added-contains-event:
155                 comment-contains-value: 'recheck'
156             - comment-added-contains-event:
157                 comment-contains-value: 'reverify'
158           projects:
159             - project-compare-type: 'REG_EXP'
160               project-pattern: '{project}'
161               branches:
162                 - branch-compare-type: 'ANT'
163                   branch-pattern: '**/{branch}'
164               file-paths:
165                 - compare-type: 'ANT'
166                   pattern: '{files}'
167           skip-vote:
168             successful: false
169             failed: false
170             unstable: false
171             notbuilt: false
172
173 - trigger:
174     name: nordix-gerrit-trigger-change-merged
175     triggers:
176       - gerrit:
177           server-name: 'Nordix Gerrit'
178           trigger-on:
179             - change-merged-event
180             - comment-added-contains-event:
181                 comment-contains-value: 'remerge'
182           projects:
183             - project-compare-type: 'ANT'
184               project-pattern: '{project}'
185               branches:
186                 - branch-compare-type: 'ANT'
187                   branch-pattern: '**/{branch}'
188               file-paths:
189                 - compare-type: 'ANT'
190                   pattern: '{files}'
191
192 - trigger:
193     name: nordix-gerrit-push-upstream
194     triggers:
195       - gerrit:
196           server-name: 'Nordix Gerrit'
197           trigger-on:
198             - comment-added-contains-event:
199                 comment-contains-value: 'push-upstream'
200           projects:
201             - project-compare-type: 'ANT'
202               project-pattern: '{project}'
203               branches:
204                 - branch-compare-type: 'ANT'
205                   branch-pattern: '**/{branch}'
206               file-paths:
207                 - compare-type: 'ANT'
208                   pattern: '{files}'
209
210 # triggers for ONAP Gerrit
211 - trigger:
212     name: onap-gerrit-trigger-change-merged
213     triggers:
214       - gerrit:
215           server-name: 'ONAP Gerrit'
216           trigger-on:
217             - change-merged-event
218             - comment-added-contains-event:
219                 comment-contains-value: 'remerge'
220           projects:
221             - project-compare-type: 'ANT'
222               project-pattern: '{project}'
223               branches:
224                 - branch-compare-type: 'ANT'
225                   branch-pattern: '**/{branch}'
226               file-paths:
227                 - compare-type: 'ANT'
228                   pattern: '{files}'
229           silent: true
230           silent-start: true
231
232 # triggers for Acumos Gerrit
233 - trigger:
234     name: acumos-gerrit-trigger-change-merged
235     triggers:
236       - gerrit:
237           server-name: 'Acumos 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           silent: true
252           silent-start: true
253
254
255 # wrappers to use for jobs
256 - wrapper:
257     name: nordixinfra-jjb-creds-wrapper
258     wrappers:
259       - credentials-binding:
260           - username-password-separated:
261               credential-id: nordixinfra-jjb-creds
262               username: JJB_USERNAME
263               password: JJB_USERTOKEN
264
265 # timeout wrapper to use for jobs
266 - wrapper:
267     name: build-timeout
268     wrappers:
269       - timeout:
270           timeout: '{timeout}'
271           timeout-var: 'BUILD_TIMEOUT'
272           fail: true
273
274 # wrapper to fix jenkins build workspace permissions
275 - wrapper:
276     name: fix-workspace-permissions
277     wrappers:
278       - pre-scm-buildstep:
279           failOnError: true
280           buildsteps:
281             - shell: |
282                 #!/bin/bash
283                 sudo chown -R $USER:$USER $WORKSPACE || exit 1
284
285 - publisher:
286     name: notify-slack
287     publishers:
288       - slack:
289           room: '{slack-channel}'
290           notify-failure: True
291
292 # property to discard old builds
293 - property:
294     name: logrotate
295     properties:
296       - build-discarder:
297           days-to-keep: 30
298           num-to-keep: 100
299           artifact-days-to-keep: 30
300           artifact-num-to-keep: 100