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 | |
Kailash Khalasi | 02cd79c | 2018-04-30 15:05:09 -0700 | [diff] [blame] | 59 | # sonarqube-ongoing-coverage |
| 60 | - builder: |
| 61 | name: cord-infra-sonarqube |
| 62 | builders: |
Zack Williams | efc1cb9 | 2018-07-17 14:11:08 -0700 | [diff] [blame] | 63 | - inject: |
| 64 | properties-content: | |
Zack Williams | 9d98e60 | 2018-07-17 15:11:31 -0700 | [diff] [blame] | 65 | SONAR_PREP_COMMANDS={sonar-prep-commands} |
Zack Williams | efc1cb9 | 2018-07-17 14:11:08 -0700 | [diff] [blame] | 66 | - shell: !include-raw-escape: shell/sonarprep.sh |
Kailash Khalasi | 02cd79c | 2018-04-30 15:05:09 -0700 | [diff] [blame] | 67 | - sonar: |
Zack Williams | eb04229 | 2019-01-14 17:12:29 -0700 | [diff] [blame] | 68 | sonar-name: 'sonar.opencord.org' |
Kailash Khalasi | 02cd79c | 2018-04-30 15:05:09 -0700 | [diff] [blame] | 69 | java-opts: '-Xmx1280m' |
| 70 | properties: | |
| 71 | sonar.sources=. |
| 72 | sonar.projectKey={project}_$GERRIT_BRANCH |
| 73 | sonar.python.pylint=/usr/local/bin/pylint |
Zack Williams | 9d98e60 | 2018-07-17 15:11:31 -0700 | [diff] [blame] | 74 | sonar.java.binaries={sonar-java-binaries} |
Kailash Khalasi | 02cd79c | 2018-04-30 15:05:09 -0700 | [diff] [blame] | 75 | |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 76 | # trigger on gerrit patchsets and actions |
| 77 | # docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit |
| 78 | - trigger: |
| 79 | name: cord-infra-gerrit-trigger-patchset |
| 80 | triggers: |
Zack Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 81 | - gerrit: |
| 82 | server-name: '{gerrit-server-name}' |
| 83 | dependency-jobs: '{dependency-jobs}' |
| 84 | silent-start: true |
| 85 | trigger-on: |
| 86 | - patchset-created-event: |
| 87 | exclude-drafts: true |
| 88 | exclude-trivial-rebase: false |
| 89 | exclude-no-code-change: true |
| 90 | - draft-published-event |
| 91 | - comment-added-contains-event: |
| 92 | comment-contains-value: '(?i)^.*recheck$' |
| 93 | projects: |
| 94 | - project-compare-type: REG_EXP |
| 95 | project-pattern: '{project-regexp}' |
| 96 | branches: |
| 97 | - branch-compare-type: REG_EXP |
| 98 | branch-pattern: '{branch-regexp}' |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 99 | file-paths: |
| 100 | - compare-type: REG_EXP |
| 101 | pattern: '{file-include-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 102 | |
| 103 | # trigger on gerrit commits/merges |
| 104 | - trigger: |
| 105 | name: cord-infra-gerrit-trigger-merge |
| 106 | triggers: |
Zack Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 107 | - gerrit: |
| 108 | server-name: '{gerrit-server-name}' |
| 109 | dependency-jobs: '{dependency-jobs}' |
Zack Williams | 9ac51db | 2018-04-16 16:44:24 -0700 | [diff] [blame] | 110 | silent-start: true |
Zack Williams | e64341b | 2018-04-10 22:14:35 -0700 | [diff] [blame] | 111 | trigger-on: |
| 112 | - change-merged-event |
| 113 | projects: |
| 114 | - project-compare-type: REG_EXP |
| 115 | project-pattern: '{project-regexp}' |
| 116 | branches: |
| 117 | - branch-compare-type: REG_EXP |
| 118 | branch-pattern: '{branch-regexp}' |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 119 | file-paths: |
| 120 | - compare-type: REG_EXP |
| 121 | pattern: '{file-include-regexp}' |
Zack Williams | 5aa37e1 | 2019-02-13 13:28:29 -0700 | [diff] [blame] | 122 | |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 123 | # Trigger on GitHub pull requests |
| 124 | # docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.github-pull-request |
| 125 | # Uses the standard 'ok to test', etc. commands per the plugin: |
| 126 | # https://github.com/jenkinsci/ghprb-plugin |
Zack Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 127 | - trigger: |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 128 | name: cord-infra-github-pr-trigger |
Zack Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 129 | triggers: |
| 130 | - github-pull-request: |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 131 | auth-id: '{github_pr_auth_id}' |
| 132 | github-hooks: true # Create github hooks automatically |
| 133 | cancel-builds-on-update: true |
| 134 | auto-close-on-fail: false |
Zack Williams | 4b5722e | 2019-02-27 15:14:04 -0700 | [diff] [blame] | 135 | only-trigger-phrase: false |
Jeremy Ronquillo | 9adc0a9 | 2020-01-29 10:49:45 -0800 | [diff] [blame] | 136 | status-context: '{status_context}' # Name of testing system in PR |
Zack Williams | 5d81f81 | 2019-02-27 14:37:09 -0700 | [diff] [blame] | 137 | permit-all: false # don't trigger on every PR |
| 138 | org-list: '{obj:github_pr_org_list}' |
| 139 | allow-whitelist-orgs-as-admins: true |
Zack Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 140 | |
You Wang | fd86905 | 2020-03-13 11:23:11 -0700 | [diff] [blame] | 141 | # Trigger on GitHub PR merge |
| 142 | # docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.generic-webhook-trigger |
| 143 | - trigger: |
| 144 | name: cord-infra-github-pr-trigger-merge |
| 145 | triggers: |
| 146 | - generic-webhook-trigger: |
| 147 | post-content-params: |
| 148 | - type: JSONPath |
| 149 | key: action |
| 150 | value: $.action |
| 151 | - type: JSONPath |
| 152 | key: merged |
| 153 | value: $.pull_request.merged |
| 154 | regex-filter-text: $action,$merged |
| 155 | regex-filter-expression: ^(closed,true)$ |
| 156 | cause: Generic Cause |
| 157 | token: '{project}' |
| 158 | |
Zack Williams | 5aa37e1 | 2019-02-13 13:28:29 -0700 | [diff] [blame] | 159 | # wrapper to provide pypi config file |
| 160 | |
| 161 | - wrapper: |
| 162 | name: cord-pypi-wrapper |
| 163 | wrappers: |
| 164 | - mask-passwords |
| 165 | - timeout: |
| 166 | type: absolute |
| 167 | timeout: '{build-timeout}' |
| 168 | timeout-var: 'BUILD_TIMEOUT' |
| 169 | fail: true |
| 170 | - timestamps |
| 171 | - ssh-agent-credentials: |
| 172 | users: |
| 173 | - '{jenkins-ssh-credential}' |
| 174 | - config-file-provider: |
| 175 | files: |
| 176 | - file-id: pypirc |
| 177 | target: '$HOME/.pypirc' |
| 178 | - file-id: pipconf |
| 179 | target: '$HOME/.config/pip/pip.conf' |
Zack Williams | 73c3cf4 | 2019-02-25 23:43:22 -0700 | [diff] [blame] | 180 | |
Zack Williams | be2f86f | 2019-09-30 22:39:13 -0700 | [diff] [blame] | 181 | # wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync |
| 182 | # Name matches macro in ONOS JJB, for future unification |
| 183 | - wrapper: |
| 184 | name: onf-infra-rsync-wrappers |
| 185 | wrappers: |
| 186 | - mask-passwords |
| 187 | - timeout: |
| 188 | type: absolute |
| 189 | timeout: '{build-timeout}' |
| 190 | timeout-var: 'BUILD_TIMEOUT' |
| 191 | fail: true |
| 192 | - timestamps |
| 193 | - ssh-agent-credentials: |
| 194 | users: |
| 195 | - '{jenkins-ssh-credential}' |
| 196 | - config-file-provider: |
| 197 | files: |
| 198 | - file-id: known_hosts |
| 199 | target: '$HOME/.ssh/known_hosts' |