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 | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 46 | # download a specific patchset after checking out entire source tree with repo |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 47 | # 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 Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 53 | DESTINATION_DIR={destination-dir} |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 54 | 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 Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 64 | - 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 Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 82 | file-paths: |
| 83 | - compare-type: REG_EXP |
| 84 | pattern: '{file-include-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 85 | |
| 86 | # trigger on gerrit commits/merges |
| 87 | - trigger: |
| 88 | name: cord-infra-gerrit-trigger-merge |
| 89 | triggers: |
Zack Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 90 | - gerrit: |
| 91 | server-name: '{gerrit-server-name}' |
| 92 | dependency-jobs: '{dependency-jobs}' |
Zack Williams | 9ac51db | 2018-04-16 16:44:24 -0700 | [diff] [blame] | 93 | silent-start: true |
Zack Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 94 | 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 Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 102 | file-paths: |
| 103 | - compare-type: REG_EXP |
| 104 | pattern: '{file-include-regexp}' |
Zack Williams | 5aa37e1 | 2019-02-13 13:28:29 -0700 | [diff] [blame] | 105 | |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 106 | # 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 Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 110 | - trigger: |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 111 | name: cord-infra-github-pr-trigger |
Zack Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 112 | triggers: |
| 113 | - github-pull-request: |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 114 | 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 Williams | 4b5722e | 2019-02-27 15:14:04 -0700 | [diff] [blame] | 118 | only-trigger-phrase: false |
Jeremy Ronquillo | 9adc0a9 | 2020-01-29 10:49:45 -0800 | [diff] [blame] | 119 | status-context: '{status_context}' # Name of testing system in PR |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 120 | 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 Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 123 | |
You Wang | fd86905 | 2020-03-13 11:23:11 -0700 | [diff] [blame] | 124 | # 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 Wang | 4487d01 | 2020-03-30 11:09:48 -0700 | [diff] [blame] | 137 | - type: JSONPath |
You Wang | 5c15a7a | 2020-04-02 11:24:33 -0700 | [diff] [blame] | 138 | 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 Wang | 4487d01 | 2020-03-30 11:09:48 -0700 | [diff] [blame] | 144 | key: branchName |
| 145 | value: $.pull_request.base.ref |
| 146 | - type: JSONPath |
You Wang | 5c15a7a | 2020-04-02 11:24:33 -0700 | [diff] [blame] | 147 | key: commitHash |
| 148 | value: $.pull_request.merge_commit_sha |
You Wang | fd86905 | 2020-03-13 11:23:11 -0700 | [diff] [blame] | 149 | regex-filter-text: $action,$merged |
| 150 | regex-filter-expression: ^(closed,true)$ |
| 151 | cause: Generic Cause |
| 152 | token: '{project}' |
| 153 | |
Zack Williams | 5aa37e1 | 2019-02-13 13:28:29 -0700 | [diff] [blame] | 154 | # 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 Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 175 | |
Zack Williams | be2f86f | 2019-09-30 22:39:13 -0700 | [diff] [blame] | 176 | # 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 Cascone | baceafe | 2021-01-10 19:28:49 -0800 | [diff] [blame] | 195 | |
| 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> |