Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame^] | 1 | # JJB Macros for ONF jobs |
| 2 | |
| 3 | # control how long builds and artifact are retained |
| 4 | # differs from lf-infra-properties as it retains artifacts |
| 5 | - property: |
| 6 | name: onf-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 | |
| 13 | # trigger on gerrit patchsets and actions |
| 14 | # docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit |
| 15 | # Uses a regex based project match |
| 16 | - trigger: |
| 17 | name: onf-infra-gerrit-trigger-patchset |
| 18 | triggers: |
| 19 | - gerrit: |
| 20 | server-name: '{gerrit-server-name}' |
| 21 | dependency-jobs: '{dependency-jobs}' |
| 22 | silent-start: true |
| 23 | trigger-on: |
| 24 | - patchset-created-event: |
| 25 | exclude-drafts: true |
| 26 | exclude-trivial-rebase: false |
| 27 | exclude-no-code-change: false |
| 28 | - draft-published-event |
| 29 | - comment-added-contains-event: |
| 30 | comment-contains-value: '(?i)^.*recheck$' |
| 31 | projects: |
| 32 | - project-compare-type: REG_EXP |
| 33 | project-pattern: '{project-regexp}' |
| 34 | branches: |
| 35 | - branch-compare-type: REG_EXP |
| 36 | branch-pattern: '{branch-regexp}' |
| 37 | file-paths: |
| 38 | - compare-type: REG_EXP |
| 39 | pattern: '{file-include-regexp}' |
| 40 | |
| 41 | |
| 42 | # same as lf-infra-gerrit-scm, but allows checkouts to a subdir of $WORKSPACE |
| 43 | # with the `basedir` option |
| 44 | # |
| 45 | # `basedir` serves the same function as `destination-dir` in the repo scm |
| 46 | # macros, seems strange that they're named differently. |
| 47 | - scm: |
| 48 | name: onf-infra-gerrit-scm |
| 49 | scm: |
| 50 | - git: |
| 51 | credentials-id: '{jenkins-ssh-credential}' |
| 52 | url: '{git-url}' |
| 53 | refspec: '{refspec}' |
| 54 | branches: |
| 55 | - 'refs/heads/{branch}' |
| 56 | skip-tag: true |
| 57 | wipe-workspace: true |
| 58 | submodule: |
| 59 | recursive: '{submodule-recursive}' |
| 60 | choosing-strategy: '{choosing-strategy}' |
| 61 | basedir: '{basedir}' |
| 62 | |
| 63 | |
| 64 | # trigger for gerrit patch submission |
| 65 | - trigger: |
| 66 | name: onf-infra-gerrit-trigger-merge |
| 67 | triggers: |
| 68 | - gerrit: |
| 69 | server-name: '{gerrit-server-name}' |
| 70 | dependency-jobs: '{dependency-jobs}' |
| 71 | silent-start: true |
| 72 | trigger-on: |
| 73 | - change-merged-event |
| 74 | projects: |
| 75 | - project-compare-type: REG_EXP |
| 76 | project-pattern: '{project-regexp}' |
| 77 | branches: |
| 78 | - branch-compare-type: REG_EXP |
| 79 | branch-pattern: '{branch-regexp}' |
| 80 | file-paths: |
| 81 | - compare-type: REG_EXP |
| 82 | pattern: '{file-include-regexp}' |
| 83 | |
| 84 | # wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync |
| 85 | - wrapper: |
| 86 | name: onf-infra-rsync-wrappers |
| 87 | wrappers: |
| 88 | - mask-passwords |
| 89 | - timeout: |
| 90 | type: absolute |
| 91 | timeout: '{build-timeout}' |
| 92 | timeout-var: 'BUILD_TIMEOUT' |
| 93 | fail: true |
| 94 | - timestamps |
| 95 | - ssh-agent-credentials: |
| 96 | users: |
| 97 | - '{jenkins-ssh-credential}' |
| 98 | - config-file-provider: |
| 99 | files: |
| 100 | - file-id: known_hosts |
| 101 | target: '$HOME/.ssh/known_hosts' |
| 102 | |