Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 1 | --- |
| 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 Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 18 | manifest-url: '{manifest-url}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 19 | manifest-branch: '{branch}' |
| 20 | destination-dir: '{destination-dir}' |
| 21 | jobs: 4 |
| 22 | reset-first: true |
| 23 | depth: 1 |
| 24 | |
Zack Williams | 15a31c8 | 2018-08-29 15:10:03 -0700 | [diff] [blame] | 25 | # 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 Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 46 | # 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 Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 51 | - 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 Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 69 | file-paths: |
| 70 | - compare-type: REG_EXP |
| 71 | pattern: '{file-include-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 72 | |
| 73 | # trigger on gerrit commits/merges |
| 74 | - trigger: |
| 75 | name: cord-infra-gerrit-trigger-merge |
| 76 | triggers: |
Zack Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 77 | - gerrit: |
| 78 | server-name: '{gerrit-server-name}' |
| 79 | dependency-jobs: '{dependency-jobs}' |
Zack Williams | 9ac51db | 2018-04-16 16:44:24 -0700 | [diff] [blame] | 80 | silent-start: true |
Zack Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 81 | 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 Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 89 | file-paths: |
| 90 | - compare-type: REG_EXP |
| 91 | pattern: '{file-include-regexp}' |
Zack Williams | 5aa37e1 | 2019-02-13 13:28:29 -0700 | [diff] [blame] | 92 | |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 93 | # 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 Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 97 | - trigger: |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 98 | name: cord-infra-github-pr-trigger |
Zack Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 99 | triggers: |
| 100 | - github-pull-request: |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 101 | 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 Williams | 4b5722e | 2019-02-27 15:14:04 -0700 | [diff] [blame] | 105 | only-trigger-phrase: false |
Jeremy Ronquillo | 9adc0a9 | 2020-01-29 10:49:45 -0800 | [diff] [blame] | 106 | status-context: '{status_context}' # Name of testing system in PR |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 107 | 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 Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 110 | |
You Wang | fd86905 | 2020-03-13 11:23:11 -0700 | [diff] [blame] | 111 | # 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 Armstrong | ca4cb46 | 2023-01-12 17:51:05 -0500 | [diff] [blame] | 117 | 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 Wang | fd86905 | 2020-03-13 11:23:11 -0700 | [diff] [blame] | 140 | |
Zack Williams | 5aa37e1 | 2019-02-13 13:28:29 -0700 | [diff] [blame] | 141 | # 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 Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 162 | |
Carmelo Cascone | baceafe | 2021-01-10 19:28:49 -0800 | [diff] [blame] | 163 | |
Zack Williams | be54231 | 2022-06-23 21:51:32 -0700 | [diff] [blame] | 164 | ################## 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 Williams | 5f25716 | 2022-07-25 14:22:29 -0700 | [diff] [blame] | 176 | # 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 Williams | be54231 | 2022-06-23 21:51:32 -0700 | [diff] [blame] | 197 | # 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 Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 325 | |
| 326 | # [EOF] |