blob: e49239dfdb2d57f50d4df91330d2f934dc40174c [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 Williamsc27ca2d2018-04-11 13:16:45 -070046# download a specific patchset after checking out entire source tree with repo
Zack Williams7468c362018-04-06 09:52:30 -070047# docs: https://docs.openstack.org/infra/jenkins-job-builder/builders.html#builders.inject
48- builder:
49 name: cord-infra-gerrit-repo-patch
50 builders:
51 - inject:
52 properties-content: |
Zack Williamsc27ca2d2018-04-11 13:16:45 -070053 DESTINATION_DIR={destination-dir}
Zack Williams7468c362018-04-06 09:52:30 -070054 GERRIT_PROJECT={project}
55 GERRIT_CHANGE_NUMBER={change-number}
56 GERRIT_PATCHSET_NUMBER={patchset-number}
57 - shell: !include-raw-escape: shell/repopatch.sh
58
59# trigger on gerrit patchsets and actions
60# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
61- trigger:
62 name: cord-infra-gerrit-trigger-patchset
63 triggers:
Zack Williamse64341b2018-04-10 22:14:35 -070064 - gerrit:
65 server-name: '{gerrit-server-name}'
66 dependency-jobs: '{dependency-jobs}'
67 silent-start: true
68 trigger-on:
69 - patchset-created-event:
70 exclude-drafts: true
71 exclude-trivial-rebase: false
72 exclude-no-code-change: true
73 - draft-published-event
74 - comment-added-contains-event:
75 comment-contains-value: '(?i)^.*recheck$'
76 projects:
77 - project-compare-type: REG_EXP
78 project-pattern: '{project-regexp}'
79 branches:
80 - branch-compare-type: REG_EXP
81 branch-pattern: '{branch-regexp}'
Zack Williamsc27ca2d2018-04-11 13:16:45 -070082 file-paths:
83 - compare-type: REG_EXP
84 pattern: '{file-include-regexp}'
Zack Williams7468c362018-04-06 09:52:30 -070085
86# trigger on gerrit commits/merges
87- trigger:
88 name: cord-infra-gerrit-trigger-merge
89 triggers:
Zack Williamse64341b2018-04-10 22:14:35 -070090 - gerrit:
91 server-name: '{gerrit-server-name}'
92 dependency-jobs: '{dependency-jobs}'
Zack Williams9ac51db2018-04-16 16:44:24 -070093 silent-start: true
Zack Williamse64341b2018-04-10 22:14:35 -070094 trigger-on:
95 - change-merged-event
96 projects:
97 - project-compare-type: REG_EXP
98 project-pattern: '{project-regexp}'
99 branches:
100 - branch-compare-type: REG_EXP
101 branch-pattern: '{branch-regexp}'
Zack Williamsc27ca2d2018-04-11 13:16:45 -0700102 file-paths:
103 - compare-type: REG_EXP
104 pattern: '{file-include-regexp}'
Zack Williams5aa37e12019-02-13 13:28:29 -0700105
Zack Williams5d81f812019-02-27 14:37:09 -0700106# Trigger on GitHub pull requests
107# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.github-pull-request
108# Uses the standard 'ok to test', etc. commands per the plugin:
109# https://github.com/jenkinsci/ghprb-plugin
Zack Williams73c3cf42019-02-25 23:43:22 -0700110- trigger:
Zack Williams5d81f812019-02-27 14:37:09 -0700111 name: cord-infra-github-pr-trigger
Zack Williams73c3cf42019-02-25 23:43:22 -0700112 triggers:
113 - github-pull-request:
Zack Williams5d81f812019-02-27 14:37:09 -0700114 auth-id: '{github_pr_auth_id}'
115 github-hooks: true # Create github hooks automatically
116 cancel-builds-on-update: true
117 auto-close-on-fail: false
Zack Williams4b5722e2019-02-27 15:14:04 -0700118 only-trigger-phrase: false
Jeremy Ronquillo9adc0a92020-01-29 10:49:45 -0800119 status-context: '{status_context}' # Name of testing system in PR
Zack Williams5d81f812019-02-27 14:37:09 -0700120 permit-all: false # don't trigger on every PR
121 org-list: '{obj:github_pr_org_list}'
122 allow-whitelist-orgs-as-admins: true
Zack Williams73c3cf42019-02-25 23:43:22 -0700123
You Wangfd869052020-03-13 11:23:11 -0700124# Trigger on GitHub PR merge
125# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.generic-webhook-trigger
126- trigger:
127 name: cord-infra-github-pr-trigger-merge
128 triggers:
129 - generic-webhook-trigger:
130 post-content-params:
131 - type: JSONPath
132 key: action
133 value: $.action
134 - type: JSONPath
135 key: merged
136 value: $.pull_request.merged
You Wang4487d012020-03-30 11:09:48 -0700137 - type: JSONPath
You Wang5c15a7a2020-04-02 11:24:33 -0700138 key: repoUrl
139 value: $.pull_request.base.repo.html_url
140 - type: JSONPath
141 key: repoName
142 value: $.pull_request.base.repo.name
143 - type: JSONPath
You Wang4487d012020-03-30 11:09:48 -0700144 key: branchName
145 value: $.pull_request.base.ref
146 - type: JSONPath
You Wang5c15a7a2020-04-02 11:24:33 -0700147 key: commitHash
148 value: $.pull_request.merge_commit_sha
You Wangfd869052020-03-13 11:23:11 -0700149 regex-filter-text: $action,$merged
150 regex-filter-expression: ^(closed,true)$
151 cause: Generic Cause
152 token: '{project}'
153
Zack Williams5aa37e12019-02-13 13:28:29 -0700154# wrapper to provide pypi config file
155
156- wrapper:
157 name: cord-pypi-wrapper
158 wrappers:
159 - mask-passwords
160 - timeout:
161 type: absolute
162 timeout: '{build-timeout}'
163 timeout-var: 'BUILD_TIMEOUT'
164 fail: true
165 - timestamps
166 - ssh-agent-credentials:
167 users:
168 - '{jenkins-ssh-credential}'
169 - config-file-provider:
170 files:
171 - file-id: pypirc
172 target: '$HOME/.pypirc'
173 - file-id: pipconf
174 target: '$HOME/.config/pip/pip.conf'
Zack Williams73c3cf42019-02-25 23:43:22 -0700175
Zack Williamsbe2f86f2019-09-30 22:39:13 -0700176# wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync
177# Name matches macro in ONOS JJB, for future unification
178- wrapper:
179 name: onf-infra-rsync-wrappers
180 wrappers:
181 - mask-passwords
182 - timeout:
183 type: absolute
184 timeout: '{build-timeout}'
185 timeout-var: 'BUILD_TIMEOUT'
186 fail: true
187 - timestamps
188 - ssh-agent-credentials:
189 users:
190 - '{jenkins-ssh-credential}'
191 - config-file-provider:
192 files:
193 - file-id: known_hosts
194 target: '$HOME/.ssh/known_hosts'
Carmelo Casconebaceafe2021-01-10 19:28:49 -0800195
196# Sets permissions for job to be visible to AetherAccess only
197# (for Aether member-only repos).
198- property:
199 name: cord-infra-aether-private
200 properties:
201 - raw:
202 xml: |
203 <hudson.security.AuthorizationMatrixProperty>
204 <inheritanceStrategy class="org.jenkinsci.plugins.matrixauth.inheritance.NonInheritingStrategy"/>
205 <permission>com.cloudbees.plugins.credentials.CredentialsProvider.Create:JenkinsPowerusers</permission>
206 <permission>com.cloudbees.plugins.credentials.CredentialsProvider.Delete:JenkinsPowerusers</permission>
207 <permission>com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains:JenkinsPowerusers</permission>
208 <permission>com.cloudbees.plugins.credentials.CredentialsProvider.Update:JenkinsPowerusers</permission>
209 <permission>com.cloudbees.plugins.credentials.CredentialsProvider.View:JenkinsPowerusers</permission>
210 <permission>hudson.model.Item.Build:JenkinsPowerusers</permission>
211 <permission>hudson.model.Item.Cancel:JenkinsPowerusers</permission>
212 <permission>hudson.model.Item.Configure:JenkinsPowerusers</permission>
213 <permission>hudson.model.Item.Delete:JenkinsPowerusers</permission>
214 <permission>hudson.model.Item.Discover:JenkinsPowerusers</permission>
215 <permission>hudson.model.Item.ExtendedRead:JenkinsPowerusers</permission>
216 <permission>hudson.model.Item.Move:JenkinsPowerusers</permission>
217 <permission>hudson.model.Item.Read:JenkinsPowerusers</permission>
218 <permission>hudson.model.Item.Workspace:JenkinsPowerusers</permission>
219 <permission>hudson.model.Run.Delete:JenkinsPowerusers</permission>
220 <permission>hudson.model.Run.Replay:JenkinsPowerusers</permission>
221 <permission>hudson.model.Run.Update:JenkinsPowerusers</permission>
222 <permission>hudson.model.Item.Discover:AetherAccess</permission>
223 <permission>hudson.model.Item.Discover:anonymous</permission>
224 <permission>hudson.model.Item.Read:AetherAccess</permission>
225 <permission>hudson.model.Item.ViewStatus:anonymous</permission>
226 </hudson.security.AuthorizationMatrixProperty>