blob: 794ce3d04cc46d41e156407a5a38a5d98654f547 [file] [log] [blame]
# JJB Macros for ONF jobs
# basic string parameters for onf projects
# differs from lf-infra-parameters as it allows to speficy a different gerrit project
- parameter:
name: onf-infra-parameters
parameters:
- string:
name: PROJECT
default: '{project}'
- string:
name: STREAM
default: '{stream}'
- string:
name: GERRIT_PROJECT
default: '{gerrit_project}'
- string:
name: GERRIT_BRANCH
default: '{stream}'
- string:
name: GERRIT_REFSPEC
default: "refs/heads/{stream}"
- string:
name: sha1
default: "origin/{stream}"
# control how long builds and artifact are retained
# differs from lf-infra-properties as it retains artifacts
- property:
name: onf-infra-properties
properties:
- build-discarder:
days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
# trigger on gerrit patchsets and actions
# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
# Uses a regex based project match
- trigger:
name: onf-infra-gerrit-trigger-patchset
triggers:
- gerrit:
server-name: '{gerrit-server-name}'
dependency-jobs: '{dependency-jobs}'
silent-start: true
trigger-on:
- patchset-created-event:
exclude-drafts: true
exclude-trivial-rebase: false
exclude-no-code-change: false
- draft-published-event
- comment-added-contains-event:
comment-contains-value: '(?i)^.*recheck$'
projects:
- project-compare-type: REG_EXP
project-pattern: '{project-regexp}'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{file-include-regexp}'
# same as lf-infra-gerrit-scm, but allows checkouts to a subdir of $WORKSPACE
# with the `basedir` option
#
# `basedir` serves the same function as `destination-dir` in the repo scm
# macros, seems strange that they're named differently.
- scm:
name: onf-infra-gerrit-scm
scm:
- git:
credentials-id: '{jenkins-ssh-credential}'
url: '{git-url}'
refspec: '{refspec}'
branches:
- 'refs/heads/{branch}'
skip-tag: true
wipe-workspace: true
submodule:
recursive: '{submodule-recursive}'
choosing-strategy: '{choosing-strategy}'
basedir: '{basedir}'
# trigger for gerrit patch submission
- trigger:
name: onf-infra-gerrit-trigger-merge
triggers:
- gerrit:
server-name: '{gerrit-server-name}'
dependency-jobs: '{dependency-jobs}'
silent-start: true
trigger-on:
- change-merged-event
projects:
- project-compare-type: REG_EXP
project-pattern: '{project-regexp}'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{file-include-regexp}'
# wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync
- wrapper:
name: onf-infra-rsync-wrappers
wrappers:
- mask-passwords
- timeout:
type: absolute
timeout: '{build-timeout}'
timeout-var: 'BUILD_TIMEOUT'
fail: true
- timestamps
- ssh-agent-credentials:
users:
- '{jenkins-ssh-credential}'
- config-file-provider:
files:
- file-id: known_hosts
target: '$HOME/.ssh/known_hosts'
# publisher to clean up the workspace after the build whatever the result
- publisher:
name: onf-infra-wscleanup-publisher
publishers:
- workspace-cleanup:
clean-if:
- success: true
- unstable: true
- failure: true
- aborted: true
- not-built: true
dirmatch: false
fail-build: true
clean-parent: false
disable-deferred-wipeout: false