Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 1 | # JJB Macros for ONF jobs |
| 2 | |
pierventre | fb03d64 | 2020-07-02 23:10:12 +0200 | [diff] [blame] | 3 | # basic string parameters for onf projects |
| 4 | # differs from lf-infra-parameters as it allows to speficy a different gerrit project |
| 5 | - parameter: |
| 6 | name: onf-infra-parameters |
| 7 | parameters: |
| 8 | - string: |
| 9 | name: PROJECT |
| 10 | default: '{project}' |
| 11 | - string: |
| 12 | name: STREAM |
| 13 | default: '{stream}' |
| 14 | - string: |
| 15 | name: GERRIT_PROJECT |
| 16 | default: '{gerrit_project}' |
| 17 | - string: |
| 18 | name: GERRIT_BRANCH |
| 19 | default: '{stream}' |
| 20 | - string: |
| 21 | name: GERRIT_REFSPEC |
| 22 | default: "refs/heads/{stream}" |
| 23 | - string: |
| 24 | name: sha1 |
| 25 | default: "origin/{stream}" |
| 26 | |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 27 | # control how long builds and artifact are retained |
| 28 | # differs from lf-infra-properties as it retains artifacts |
| 29 | - property: |
| 30 | name: onf-infra-properties |
| 31 | properties: |
| 32 | - build-discarder: |
| 33 | days-to-keep: '{build-days-to-keep}' |
| 34 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 35 | |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 36 | # trigger on gerrit patchsets and actions |
| 37 | # docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit |
| 38 | # Uses a regex based project match |
| 39 | - trigger: |
| 40 | name: onf-infra-gerrit-trigger-patchset |
| 41 | triggers: |
| 42 | - gerrit: |
| 43 | server-name: '{gerrit-server-name}' |
| 44 | dependency-jobs: '{dependency-jobs}' |
| 45 | silent-start: true |
| 46 | trigger-on: |
| 47 | - patchset-created-event: |
| 48 | exclude-drafts: true |
| 49 | exclude-trivial-rebase: false |
| 50 | exclude-no-code-change: false |
| 51 | - draft-published-event |
| 52 | - comment-added-contains-event: |
| 53 | comment-contains-value: '(?i)^.*recheck$' |
| 54 | projects: |
| 55 | - project-compare-type: REG_EXP |
| 56 | project-pattern: '{project-regexp}' |
| 57 | branches: |
| 58 | - branch-compare-type: REG_EXP |
| 59 | branch-pattern: '{branch-regexp}' |
| 60 | file-paths: |
| 61 | - compare-type: REG_EXP |
| 62 | pattern: '{file-include-regexp}' |
| 63 | |
| 64 | |
| 65 | # same as lf-infra-gerrit-scm, but allows checkouts to a subdir of $WORKSPACE |
| 66 | # with the `basedir` option |
| 67 | # |
| 68 | # `basedir` serves the same function as `destination-dir` in the repo scm |
| 69 | # macros, seems strange that they're named differently. |
| 70 | - scm: |
| 71 | name: onf-infra-gerrit-scm |
| 72 | scm: |
| 73 | - git: |
| 74 | credentials-id: '{jenkins-ssh-credential}' |
| 75 | url: '{git-url}' |
| 76 | refspec: '{refspec}' |
| 77 | branches: |
| 78 | - 'refs/heads/{branch}' |
| 79 | skip-tag: true |
| 80 | wipe-workspace: true |
| 81 | submodule: |
| 82 | recursive: '{submodule-recursive}' |
| 83 | choosing-strategy: '{choosing-strategy}' |
| 84 | basedir: '{basedir}' |
| 85 | |
| 86 | |
| 87 | # trigger for gerrit patch submission |
| 88 | - trigger: |
| 89 | name: onf-infra-gerrit-trigger-merge |
| 90 | triggers: |
| 91 | - gerrit: |
| 92 | server-name: '{gerrit-server-name}' |
| 93 | dependency-jobs: '{dependency-jobs}' |
| 94 | silent-start: true |
| 95 | trigger-on: |
| 96 | - change-merged-event |
| 97 | projects: |
| 98 | - project-compare-type: REG_EXP |
| 99 | project-pattern: '{project-regexp}' |
| 100 | branches: |
| 101 | - branch-compare-type: REG_EXP |
| 102 | branch-pattern: '{branch-regexp}' |
| 103 | file-paths: |
| 104 | - compare-type: REG_EXP |
| 105 | pattern: '{file-include-regexp}' |
| 106 | |
| 107 | # wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync |
| 108 | - wrapper: |
| 109 | name: onf-infra-rsync-wrappers |
| 110 | wrappers: |
| 111 | - mask-passwords |
| 112 | - timeout: |
| 113 | type: absolute |
| 114 | timeout: '{build-timeout}' |
| 115 | timeout-var: 'BUILD_TIMEOUT' |
| 116 | fail: true |
| 117 | - timestamps |
| 118 | - ssh-agent-credentials: |
| 119 | users: |
| 120 | - '{jenkins-ssh-credential}' |
| 121 | - config-file-provider: |
| 122 | files: |
| 123 | - file-id: known_hosts |
| 124 | target: '$HOME/.ssh/known_hosts' |
| 125 | |
pierventre | fb03d64 | 2020-07-02 23:10:12 +0200 | [diff] [blame] | 126 | # publisher to clean up the workspace after the build whatever the result |
| 127 | - publisher: |
| 128 | name: onf-infra-wscleanup-publisher |
| 129 | publishers: |
| 130 | - workspace-cleanup: |
| 131 | clean-if: |
| 132 | - success: true |
| 133 | - unstable: true |
| 134 | - failure: true |
| 135 | - aborted: true |
| 136 | - not-built: true |
| 137 | dirmatch: false |
| 138 | fail-build: true |
| 139 | clean-parent: false |
| 140 | disable-deferred-wipeout: false |