blob: 9731559ca9db64037fcfc67b14ca8ed5da3aa366 [file] [log] [blame]
Zack Williams7468c362018-04-06 09:52:30 -07001---
2# CORD JJB macros
3
4# control how long builds and artifact are retained
5- property:
6 name: cord-infra-properties
7 properties:
8 - build-discarder:
9 days-to-keep: '{build-days-to-keep}'
10 artifact-num-to-keep: '{artifact-num-to-keep}'
11
12# checkout entire source tree with repo
13# docs: https://docs.openstack.org/infra/jenkins-job-builder/scm.html#scm.repo
14- scm:
15 name: cord-infra-gerrit-repo-scm
16 scm:
17 - repo:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070018 manifest-url: '{manifest-url}'
Zack Williams7468c362018-04-06 09:52:30 -070019 manifest-branch: '{branch}'
20 destination-dir: '{destination-dir}'
21 jobs: 4
22 reset-first: true
23 depth: 1
24
Zack Williams15a31c82018-08-29 15:10:03 -070025# same as lf-infra-gerrit-scm, but allows checkouts to a subdir of $WORKSPACE
26# with the `basedir` option
27#
28# `basedir` serves the same function as `destination-dir` in the repo scm
29# macros, seems strange that they're named differently.
30- scm:
31 name: cord-infra-gerrit-scm
32 scm:
33 - git:
34 credentials-id: '{jenkins-ssh-credential}'
35 url: '{git-url}'
36 refspec: '{refspec}'
37 branches:
38 - 'refs/heads/{branch}'
39 skip-tag: true
40 wipe-workspace: true
41 submodule:
42 recursive: '{submodule-recursive}'
43 choosing-strategy: '{choosing-strategy}'
44 basedir: '{basedir}'
45
Zack Williams7468c362018-04-06 09:52:30 -070046# trigger on gerrit patchsets and actions
47# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
48- trigger:
49 name: cord-infra-gerrit-trigger-patchset
50 triggers:
Zack Williamse64341b2018-04-10 22:14:35 -070051 - gerrit:
52 server-name: '{gerrit-server-name}'
53 dependency-jobs: '{dependency-jobs}'
54 silent-start: true
55 trigger-on:
56 - patchset-created-event:
57 exclude-drafts: true
58 exclude-trivial-rebase: false
59 exclude-no-code-change: true
60 - draft-published-event
61 - comment-added-contains-event:
62 comment-contains-value: '(?i)^.*recheck$'
63 projects:
64 - project-compare-type: REG_EXP
65 project-pattern: '{project-regexp}'
66 branches:
67 - branch-compare-type: REG_EXP
68 branch-pattern: '{branch-regexp}'
Zack Williamsc27ca2d2018-04-11 13:16:45 -070069 file-paths:
70 - compare-type: REG_EXP
71 pattern: '{file-include-regexp}'
Zack Williams7468c362018-04-06 09:52:30 -070072
73# trigger on gerrit commits/merges
74- trigger:
75 name: cord-infra-gerrit-trigger-merge
76 triggers:
Zack Williamse64341b2018-04-10 22:14:35 -070077 - gerrit:
78 server-name: '{gerrit-server-name}'
79 dependency-jobs: '{dependency-jobs}'
Zack Williams9ac51db2018-04-16 16:44:24 -070080 silent-start: true
Zack Williamse64341b2018-04-10 22:14:35 -070081 trigger-on:
82 - change-merged-event
83 projects:
84 - project-compare-type: REG_EXP
85 project-pattern: '{project-regexp}'
86 branches:
87 - branch-compare-type: REG_EXP
88 branch-pattern: '{branch-regexp}'
Zack Williamsc27ca2d2018-04-11 13:16:45 -070089 file-paths:
90 - compare-type: REG_EXP
91 pattern: '{file-include-regexp}'
Zack Williams5aa37e12019-02-13 13:28:29 -070092
Zack Williams5d81f812019-02-27 14:37:09 -070093# Trigger on GitHub pull requests
94# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.github-pull-request
95# Uses the standard 'ok to test', etc. commands per the plugin:
96# https://github.com/jenkinsci/ghprb-plugin
Zack Williams73c3cf42019-02-25 23:43:22 -070097- trigger:
Zack Williams5d81f812019-02-27 14:37:09 -070098 name: cord-infra-github-pr-trigger
Zack Williams73c3cf42019-02-25 23:43:22 -070099 triggers:
100 - github-pull-request:
Zack Williams5d81f812019-02-27 14:37:09 -0700101 auth-id: '{github_pr_auth_id}'
102 github-hooks: true # Create github hooks automatically
103 cancel-builds-on-update: true
104 auto-close-on-fail: false
Zack Williams4b5722e2019-02-27 15:14:04 -0700105 only-trigger-phrase: false
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -0800106 status-context: '{status_context}' # Name of testing system in PR
Zack Williams5d81f812019-02-27 14:37:09 -0700107 permit-all: false # don't trigger on every PR
108 org-list: '{obj:github_pr_org_list}'
109 allow-whitelist-orgs-as-admins: true
Zack Williams73c3cf42019-02-25 23:43:22 -0700110
You Wangfd869052020-03-13 11:23:11 -0700111# Trigger on GitHub PR merge
112# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.generic-webhook-trigger
113- trigger:
114 name: cord-infra-github-pr-trigger-merge
115 triggers:
116 - generic-webhook-trigger:
Joey Armstrongca4cb462023-01-12 17:51:05 -0500117 post-content-params:
118 - type: JSONPath
119 key: action
120 value: $.action
121 - type: JSONPath
122 key: merged
123 value: $.pull_request.merged
124 - type: JSONPath
125 key: repoUrl
126 value: $.pull_request.base.repo.html_url
127 - type: JSONPath
128 key: repoName
129 value: $.pull_request.base.repo.name
130 - type: JSONPath
131 key: branchName
132 value: $.pull_request.base.ref
133 - type: JSONPath
134 key: commitHash
135 value: $.pull_request.merge_commit_sha
136 regex-filter-text: $action,$merged
137 regex-filter-expression: ^(closed,true)$
138 cause: Generic Cause
139 token: '{project}'
You Wangfd869052020-03-13 11:23:11 -0700140
Zack Williams5aa37e12019-02-13 13:28:29 -0700141# wrapper to provide pypi config file
142
143- wrapper:
144 name: cord-pypi-wrapper
145 wrappers:
146 - mask-passwords
147 - timeout:
148 type: absolute
149 timeout: '{build-timeout}'
150 timeout-var: 'BUILD_TIMEOUT'
151 fail: true
152 - timestamps
153 - ssh-agent-credentials:
154 users:
155 - '{jenkins-ssh-credential}'
156 - config-file-provider:
157 files:
158 - file-id: pypirc
159 target: '$HOME/.pypirc'
160 - file-id: pipconf
161 target: '$HOME/.config/pip/pip.conf'
Zack Williams73c3cf42019-02-25 23:43:22 -0700162
Carmelo Casconebaceafe2021-01-10 19:28:49 -0800163
Zack Williamsbe542312022-06-23 21:51:32 -0700164################## NEW and CONVERGED MACROS ###################
165# Name matches macro in ONOS/Aether JJB, for future unification
166
167# control how long builds and artifact are retained
168# differs from lf-infra-properties as it retains artifacts
169- property:
170 name: onf-infra-properties
171 properties:
172 - build-discarder:
173 days-to-keep: '{build-days-to-keep}'
174 artifact-num-to-keep: '{artifact-num-to-keep}'
175
Zack Williams5f257162022-07-25 14:22:29 -0700176# Permissions specific to VOLTHA jobs
177# JJB supports this, but not the GROUP annotation which causes warnings
178# https://jenkins-job-builder.readthedocs.io/en/latest/properties.html?highlight=matrix#properties.authorization
179- property:
180 name: onf-infra-volthadevs-permissions
181 properties:
182 - raw:
183 xml: |
184 <hudson.security.AuthorizationMatrixProperty>
185 <inheritanceStrategy class="org.jenkinsci.plugins.matrixauth.inheritance.InheritParentStrategy"/>
186 <permission>GROUP:hudson.model.Item.Build:VOLTHADevs</permission>
187 <permission>GROUP:hudson.model.Item.Cancel:VOLTHADevs</permission>
188 <permission>GROUP:hudson.model.Item.Configure:VOLTHADevs</permission>
189 <permission>GROUP:hudson.model.Item.Discover:VOLTHADevs</permission>
190 <permission>GROUP:hudson.model.Item.ExtendedRead:VOLTHADevs</permission>
191 <permission>GROUP:hudson.model.Item.Read:VOLTHADevs</permission>
192 <permission>GROUP:hudson.model.Item.Workspace:VOLTHADevs</permission>
193 <permission>GROUP:hudson.model.Run.Replay:VOLTHADevs</permission>
194 <permission>GROUP:hudson.model.Run.Update:VOLTHADevs</permission>
195 </hudson.security.AuthorizationMatrixProperty>
196
Zack Williamsbe542312022-06-23 21:51:32 -0700197# wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync
198- wrapper:
199 name: onf-infra-rsync-wrappers
200 wrappers:
201 - mask-passwords
202 - timeout:
203 type: absolute
204 timeout: '{build-timeout}'
205 timeout-var: 'BUILD_TIMEOUT'
206 fail: true
207 - timestamps
208 - ssh-agent-credentials:
209 users: '{obj:ssh_credential_list}'
210 - config-file-provider:
211 files:
212 - file-id: known_hosts
213 target: '$HOME/.ssh/known_hosts'
214
215# trigger on gerrit patchsets and actions
216# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
217# Uses a regex based project match
218- trigger:
219 name: onf-infra-gerrit-trigger-patchset
220 triggers:
221 - gerrit:
222 server-name: '{gerrit-server-name}'
223 dependency-jobs: '{dependency-jobs}'
224 silent-start: true
225 trigger-on:
226 - patchset-created-event:
227 exclude-drafts: true
228 exclude-trivial-rebase: false
229 exclude-no-code-change: false
230 - draft-published-event
231 - comment-added-contains-event:
232 comment-contains-value: '(?i)^.*recheck$'
233 projects:
234 - project-compare-type: REG_EXP
235 project-pattern: '{project-regexp}'
236 branches:
237 - branch-compare-type: REG_EXP
238 branch-pattern: '{branch-regexp}'
239 file-paths:
240 - compare-type: REG_EXP
241 pattern: '{file-include-regexp}'
242
243# trigger for gerrit patch submission
244- trigger:
245 name: onf-infra-gerrit-trigger-merge
246 triggers:
247 - gerrit:
248 server-name: '{gerrit-server-name}'
249 dependency-jobs: '{dependency-jobs}'
250 silent-start: true
251 trigger-on:
252 - change-merged-event
253 projects:
254 - project-compare-type: REG_EXP
255 project-pattern: '{project-regexp}'
256 branches:
257 - branch-compare-type: REG_EXP
258 branch-pattern: '{branch-regexp}'
259 file-paths:
260 - compare-type: REG_EXP
261 pattern: '{file-include-regexp}'
262
263# same as lf-infra-*-scm, but allows checkouts to a subdir of $WORKSPACE
264# with the `basedir` option
265#
266# `basedir` is used as `destination-dir` for the repo scm macros for
267# consistency
268
269- scm:
270 name: onf-infra-gerrit-scm
271 scm:
272 - git:
273 credentials-id: '{jenkins-ssh-credential}'
274 url: '{git-url}'
275 refspec: '{refspec}'
276 branches:
277 - 'refs/heads/{branch}'
278 wipe-workspace: true
279 submodule:
280 disable: '{submodule-disable}'
281 recursive: '{submodule-recursive}'
282 timeout: '{submodule-timeout}'
283 choosing-strategy: '{choosing-strategy}'
284 basedir: '{basedir}'
285
286- scm:
287 name: onf-infra-gerrit-repo-scm
288 scm:
289 - repo:
290 manifest-url: '{manifest-url}'
291 manifest-branch: '{branch}'
292 destination-dir: '{basedir}'
293 jobs: 4
294 reset-first: true
295 depth: 1
296
297# download a specific patchset after checking out entire source tree with repo
298# docs: https://docs.openstack.org/infra/jenkins-job-builder/builders.html#builders.inject
299- builder:
300 name: onf-infra-gerrit-repo-patch
301 builders:
302 - inject:
303 properties-content: |
304 BASEDIR={basedir}
305 GERRIT_PROJECT={project}
306 GERRIT_CHANGE_NUMBER={change-number}
307 GERRIT_PATCHSET_NUMBER={patchset-number}
308 - shell: !include-raw-escape: shell/repo-patch.sh
309
310# publisher to clean up the workspace after the build whatever the result
311- publisher:
312 name: onf-infra-wscleanup-publisher
313 publishers:
314 - workspace-cleanup:
315 clean-if:
316 - success: true
317 - unstable: true
318 - failure: true
319 - aborted: true
320 - not-built: true
321 dirmatch: false
322 fail-build: true
323 clean-parent: false
324 disable-deferred-wipeout: false
Joey Armstrongaf679da2023-01-31 14:22:41 -0500325
326# [EOF]