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, see Mutibranch Pipeline Template yaml syntax guide. |
Parameter | Type | Description |
---|---|---|
|
String |
Specify the name of the GitHub Organization or GitHub User Account. |
|
String |
The repository to scan. |
|
String |
The server to connect to. The list of servers is configured in the Manage Jenkins » Configure Jenkins › GitHub Enterprise Servers page. |
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
String |
Credentials used to scan branches and pull requests, check out sources, and mark commit statuses. Only username with password credentials are supported. Existing credentials of other kinds will be filtered out. This is because Jenkins uses the GitHub API, which does not support other ways of authentication. If none is given, only the public repositories will be scanned, and commit status will not be set on GitHub. If your organization contains private repositories, then you need to specify a credential from a user who has access to those repositories. This is done by creating a username with password credential where the password is GitHub personal access tokens. The necessary scope is repo. |
|
String |
|
|
String |
|
|
String |
|
|
List of Nested Choice of SCMSourceTrait objects |
The behaviors control what is discovered from the GitHub repository. |
SCMSourceTrait objects
-
$class: 'AuthorInChangelogTrait'
Use Commit author in changelog.
-
$class: 'CheckoutOptionTrait'
Advanced checkout behaviors.
Table 2. CheckoutOptionTrait
parametersParameter Type Description extension
Nested CheckoutOption object
-
$class: 'CleanAfterCheckoutTrait'
Clean after checkout.
-
$class: 'CleanBeforeCheckoutTrait'
Clean before checkout.
-
$class: 'CloneOptionTrait'
Advanced clone behaviors.
Table 3. CloneOptionTrait
parametersParameter Type Description extension
Nested CloneOption object
-
$class: 'GitLFSPullTrait'
Git LFS pull after checkout.
-
$class: 'GitToolSCMSourceTrait'
Table 4. GitToolSCMSourceTrait
parametersParameter Type Description gitTool
String
-
$class: 'LocalBranchTrait'
Checkout to matching local branches.
-
$class: 'PruneStaleBranchTrait'
Prune stale remote-tracking branches.
-
$class: 'RefSpecsSCMSourceTrait'
Specify ref specs.
Table 5. RefSpecsSCMSourceTrait
parametersParameter Type Description templates
List of Nested RefSpecTemplate object
-
headRegexFilter
Filter by name (with regular expression)
Table 6. headRegexFilter
parametersParameter Type Description regex
String
A Java regular expression to restrict the names. Names that do not match the supplied regular expression will be ignored.
This filter will be applied to all branch like things, including change requests. -
$class: 'RemoteNameSCMSourceTrait'
Configure remote name.
Table 7. RemoteNameSCMSourceTrait
parametersParameter Type Description remoteName
String
-
$class: 'SparseCheckoutPathsTrait'
Sparse Checkout paths.
Table 8. SparseCheckoutPathsTrait
parametersParameter Type Description extension
Nested SparseCheckoutPaths object
-
$class: 'SubmoduleOptionTrait'
Advanced sub-modules behaviors
Table 9. SubmoduleOptionTrait
parametersParameter Type Description extension
Nested SubmoduleOption object
-
$class: 'UserIdentityTrait'
Custom user/e-mail address.
Table 10. UserIdentityTrait
parametersParameter Type Description extension
Nested UserIdentity object
-
headWildcardFilter
Filter by name (with wildcards)
Table 11. headWildcardFilter
parametersParameter Type Description includes
String
Space-separated list of name patterns to consider. You may use
*
as a wildcard; for example:main release*
.This filter will be applied to all branch like things, including change requests. excludes
String
Space-separated list of name patterns to ignore even if matched by the includes list. For example: release
alpha-* beta-*
.This filter will be applied to all branch like things, including change requests. -
$class: 'WipeWorkspaceTrait'
Wipe out repository data and force clone.
-
Discovers branches on the repository.
Table 12. gitHubBranchDiscovery
parametersParameter Type Description strategyId
int
Determines which branches are discovered.
-
Exclude branches that are also filed as PRs
If you are discovering origin pull requests, you may not want to also build the source branches for those pull requests.
-
Only branches that are also filed as PRs
Similar to discovering origin pull requests, but discovers the branch rather than the pull request. This means
env.GIT_BRANCH
will be set to the branch name rather thanPR-#
. Also, status notifications for these builds will only be applied to the commit and not to the pull request. -
All branches
Ignores whether the branch is also filed as a pull request and instead discovers all branches on the origin repository.
-
-
Discovers pull requests where the origin repository is a fork of the target repository.
Table 13. gitHubForkDiscovery
parametersParameter Type Description strategyId
int
Determines how pull requests are discovered.
-
Merging the pull request with the current target branch revision
Discover each pull request once with the discovered revision corresponding to the result of merging with the current revision of the target branch.
-
The current pull request revision
Discover each pull request once with the discovered revision corresponding to the pull request head revision without merging.
-
Both the current pull request revision and the pull request merged with the current target branch revision
Discover each pull request twice. The first discovered revision corresponds to the result of merging with the current revision of the target branch in each scan. The second parallel discovered revision corresponds to the pull request head revision without merging.
trust
Nested Choice of SCMHeadAuthority objects
One of the great powers of pull requests is that anyone with read access to a repository can fork it, commit some changes to their fork and then create a pull request against the original repository with their changes. There are some files stored in source control that are important.
For example, a
Jenkinsfile
may contain configuration details to sandbox pull requests in order to mitigate against malicious pull requests. In order to protect against a malicious pull request itself modifying theJenkinsfile
to remove the protections, you can define the trust policy for pull requests from forks. Other plugins can extend the available trust policies. -
-
Discovers pull requests where the origin repository is the same as the target repository.
Table 14. gitHubPullRequestDiscovery
parametersParameter Type Description strategyId
int
Determines how pull requests are discovered.
-
Merging the pull request with the current target branch revision
Discover each pull request once with the discovered revision corresponding to the result of merging with the current revision of the target branch.
-
The current pull request revision
Discover each pull request once with the discovered revision corresponding to the pull request head revision without merging.
-
Both the current pull request revision and the pull request merged with the current target branch revision
Discover each pull request twice. The first discovered revision corresponds to the result of merging with the current revision of the target branch in each scan. The second parallel discovered revision corresponds to the pull request head revision without merging.
-
-
By default the discovered branches/pull requests will all use the same username/password credentials that were used for discovery when checking out sources.
This means that the checkout will be using the
https://
protocol for the Git repository.
This behavior allows you to select the SSH private key to be used for checking out sources, which will consequently force the checkout to use the ssh://`
protocol.
+
.gitHubSshCheckout
parameters
Parameter |
Type |
Description |
|
String |
Credentials used to check out sources. Must be a SSH key based credential. |
-
gitHubTagDiscovery
Discovers tags on the repository
SCMHeadAuthority objects
-
$class: 'TrustNobody'
Pull requests from forks will all be treated as untrusted. This means that where Jenkins requires a trusted file (for example,
Jenkinsfile
) the contents of that file will be retrieved from the target branch on the origin repository and not from the pull request branch on the fork repository. -
$class: 'TrustContributors'
Pull requests from collaborators to the origin repository will be treated as trusted, all other pull requests from fork repositories will be treated as untrusted. If credentials used by Jenkins for scanning the repository does not have permission to query the list of contributors to the origin repository then only the origin account will be treated as trusted - in other words, this will fall back to Nobody.
All collaborators are trusted, even if they are only members of a team with read permission. |
-
$class: 'TrustEveryone'
All pull requests from forks will be treated as trusted.
This option can be dangerous if used on a public repository hosted on GitHub. |
-
$class: 'TrustPermission'
Pull requests forks will be treated as trusted if and only if the fork owner has either Admin or Write permissions on the origin repository. This is the recommended policy. This strategy requires the Review a user’s permission level API, as a result on GitHub Enterprise Server versions before 2.12 this is the same as trusting Nobody.
Nested objects
CheckoutOption object
Advanced checkout behaviors.
Parameter | Type | Description |
---|---|---|
|
int |
Specify a timeout (in minutes) for checkout. This option overrides the default timeout of 10 minutes. You can change the global git timeout via the property Property should be set on both controller and agent to have effect. |
CloneOption object
Advanced clone behaviors.
Parameter | Type | Description |
---|---|---|
|
boolean |
Perform shallow clone, so that Git will not download the history of the project, saving time and disk space when you just want to access the latest version of a repository. |
|
boolean |
Deselect this to perform a clone without tags, saving time and disk space when you just want to access what is specified by the refspec. |
|
String |
Specify a folder containing a repository that will be used by Git as a reference during clone operations. This option will be ignored if the folder is not available on the controller or agent where the clone is being executed. |
|
int |
Specify a timeout (in minutes) for clone and fetch operations. This option overrides the default timeout of 10 minutes. You can change the global git timeout via the property |
|
int |
Set shallow clone depth, so that Git will only download recent history of the project, saving time and disk space when you just want to access the latest commits of a repository. |
|
boolean |
Perform initial clone using the refspec defined for the repository. This can save time, data transfer and disk space when you only need to access the references specified by the refspec. |
RefSpecTemplate object
Ref Spec
Parameter | Type | Description |
---|---|---|
|
String |
A ref spec to fetch. Any occurrences of |
SparseCheckoutPath object
Path
Parameter | Type | Description |
---|---|---|
|
String |
SparseCheckoutPaths object
Specify the paths that you’d like to sparse checkout. This may be used for saving space (for example, a reference repository). Be sure to use a recent version of Git, at least above 1.7.10.
Parameter | Type | Description |
---|---|---|
|
List of Nested SparseCheckoutPath object |
SubmoduleOption object
Advanced submodules behaviors.
Parameter | Type | Description |
---|---|---|
|
boolean |
By disabling support for submodules you can still keep using basic Git plugin functionality and just have Jenkins ignore submodules completely as if they didn’t exist. |
|
boolean |
Retrieve all submodules recursively (uses '--recursive' option which requires Git version 1.6.5 or higher). |
|
boolean |
Retrieve the tip of the configured branch in |
|
String |
Specify a folder containing a repository that will be used by Git as a reference during clone operations. This option will be ignored if the folder is not available on the controller or agent where the clone is being executed. To prepare a reference folder with multiple subprojects, create a bare Git repository and add all the remote urls then perform a fetch using the following commands:
|
|
int |
Specify a timeout (in minutes) for submodules operations. This option overrides the default timeout of 10 minutes. You can change the global git timeout via the property |
|
boolean |
Use credentials from the default remote of the parent project. |
|
int |
Set shallow clone depth, so that Git will only download recent history of the project, saving time and disk space when you just want to access the latest commits of a repository. |
|
boolean |
Perform shallow clone, so that Git will not download the history of the project, saving time and disk space when you just want to access the latest version of a repository. |
|
int |
UserIdentity object
Custom user name/email address.
Parameter | Type | Description |
---|---|---|
|
String |
If given, |
|
String |
If given, |