The starting point is the BranchSource object, so configurations always start with branchSource: .
|
For more information on how to configure various options related to Multibranch Pipelines via YAML syntax, refer to Multibranch Pipeline Template syntax. |
GitHub
-
gitHubBranchDiscovery
: This example applies a behavior that discovers branches, excluding branches that are also filed as PRs. -
gitHubPullRequestDiscovery
andgitHubForkDiscovery
: This example applies behaviors that --
discover pull requests backed by branches in the origin repository by merging the pull request with the current revision of the target branch.
-
discover pull requests backed by branches in forked repositories by merging the pull request with the current revision of the target branch.
-
only accept
Jenkinsfile
changes from users with admin or write permission to the repository on GitHub.
-
-
gitHubSshCheckout
: This example applies a behavior that forces GitHub checkouts to use thessh://
protocol.
multibranch: branchSource: github: repoOwner: 'organization' repository: 'repository' credentialsId: 'github-credentials' traits: - gitHubBranchDiscovery: strategyId: 1
multibranch: branchSource: github: repoOwner: 'organization' repository: 'repository' credentialsId: 'github-credentials' traits: - gitHubPullRequestDiscovery: strategyId: 1 - gitHubForkDiscovery: strategyId: 1 trust: $class: TrustPermission
multibranch: branchSource: github: repoOwner: 'organization' repository: 'repository' credentialsId: 'github-credentials' traits: - gitHubSshCheckout: credentialsId: 'github-ssh-credentials-id'
Git
-
This example applies behaviors that discover all branches and refs matching the pattern
custom/team/*
, and cleans the workspace before every checkout, and explicitly configures GitHub to be the repository browser for the project.multibranch: branchSource: git: remote: 'https://github.com/owner/repo.git' credentialsId: 'git-credentials' traits: - gitBranchDiscovery - $class: DiscoverOtherRefsTrait ref: 'custom/team/*' - cleanBeforeCheckout - $class: GitBrowserSCMSourceTrait browser: $class: GithubWeb repoUrl: 'https://github.com/owner/repo'
Bitbucket
-
bitbucketBranchDiscovery
: This example applies a behavior that discovers branches, excluding branches that are also filed as PRs. -
bitbucketPullRequestDiscovery
andbitbucketForkDiscovery
: This example applies a behavior that discovers pull requests backed by branches in the origin repository by merging the pull request with the current revision of the target branch in addition to a behavior that discovers pull requests backed by branches in forked repositories by merging the pull request with the current revision of the target branch, and that only acceptsJenkinsfile
changes from forks belonging to the same account as the origin repository. -
bitbucketSshCheckout
: This example applies a behavior that forces GitHub checkouts to use thessh://
protocol.
multibranch: branchSource: bitbucket: repoOwner: 'organization' repository: 'repository' credentialsId: 'bitbucket-credentials' traits: - bitbucketBranchDiscovery: strategyId: 1
multibranch: branchSource: bitbucket: repoOwner: 'organization' repository: 'repository' credentialsId: 'github-credentials' traits: - bitbucketPullRequestDiscovery: strategyId: 1 - bitbucketForkDiscovery: strategyId: 1 trust: $class: TrustTeamForks
multibranch: branchSource: bitbucket: repoOwner: 'organization' repository: 'repository' credentialsId: 'bitbucket-credentials' traits: - bitbucketSshCheckout: credentialsId: 'bitbucket-ssh-credentials'
Property Strategies
-
$class: DefaultBranchPropertyStrategy
: This example applies a property to all branches that prevents branch indexing from triggering a build of that branch. -
$class: NamedExceptionsBranchPropertyStrategy
: This example applies a property to themain
branch so that it is built using theMAX_SURVIVABILITY
durability level while all other branches are built using thePERFORMANCE_OPTIMIZED
durability level.
multibranch: branchSource: github: repoOwner: 'organization' repository: 'repository' credentialsId: 'github-credentials' strategy: $class: DefaultBranchPropertyStrategy props: - $class: NoTriggerBranchProperty strategy: INDEXING
multibranch: branchSource: github: repoOwner: 'organization' repository: 'repository' credentialsId: 'github-credentials' strategy: $class: NamedExceptionsBranchPropertyStrategy namedExceptions: - $class: Named name: main props: - $class: DurabilityHintBranchProperty hint: MAX_SURVIVABILITY defaultProperties: - $class: DurabilityHintBranchProperty hint: PERFORMANCE_OPTIMIZED