:warning: Notice of Deprecation: Parameterized Builds for Jenkins is now deprecated. No new feature development will be done and users are encouraged to seek other alternatives to trigger their Jenkins jobs.
Jenkins servers can be defined globally on the Administration page of Bitbucket Server or per project on the project settings page.
Base URL
should be the http/https root address to you jenkins serverServer Nickname
is a unique name for this server. This is used by job settings to choose which
Bitbucket Server to run the job on.Default User
and Default Token
are optional and used as a fall back
authentication for triggering jobsBuild Token Root Plugin
uses an alternate address for triggering builds anonymously. Enable this only if you have the Build Token Root Plugin installed in Jenkins CSRF
if your Jenkins is CSRF protected, enable this option
Enable Parameterized Builds for Jenkins under the hooks settings for a repository.
You can add as many jobs as you want (within reason),
they will be triggered in the order they are added.
Job Name
is the name of the jenkins job to trigger. If the job is contained in a
folder set the job name as
folderName/job/jobName.Ref Type
will apply your triggers to either branch operations or tag operationsToken
correspondes to the authorization token on your job configuration page in JenkinsRef Filter
uses java regex syntax to only trigger a
build for branches/tags that match the filter
Monitored Paths
will only trigger a build if a file in the diff matches the filter
Required Build Permission
will restrict who can trigger a Jenkins job using the repository permissions
PR Destination Filter
functions identically to Ref Filter
but on the branch being merged intoIgnore Committers
list of bitbucket user names separated by new line, Commits from any of these specified users
will be ignored and will not trigger any builds
Ignore Commits With String
If a commit message contains this configured string in it,
that commit will be ignored and will not trigger any builds. Uses java regex syntax
On your user account page you can add your Jenkins API token.
When added bitbucket server will use your Jenkins account
to trigger jobs for branches you create/push, pull requests you open, or for manual builds.
If you have multiple Jenkins servers setup you can set the api token for each one.
Order of authentication:
The Jenkins user Token
from the Jenkins User Settings will be used for authentation first.
If that is not set then the Token
parameter in the job configuration will be used second.
If that is not set then the Default User
and Default Token
on the Jenkins
server settings page will be used.
You can use any combination of triggers.
REF CREATED
Ref Filter
parameter (leave blank to match all)PUSH EVENT
Ref Filter
parameter (leave blank to match all)Monitored Paths
parameter (leave blank to match all)MANUAL
MANUAL
trigger then the user will be prompted to choose which job to triggerREF DELETED
Ref Filter
parameter (leave blank to match all)AUTO MERGED
Monitored Paths
parameter (leave blank to match all)PR OPENED
Monitored Paths
parameter (leave blank to match all)PR REOPENED
Monitored Paths
parameter (leave blank to match all)PR SOURCE RESCOPED
Monitored Paths
parameter (leave blank to match all)PR DEST RESCOPED
Monitored Paths
parameter (leave blank to match all)PR MERGED
Monitored Paths
parameter (leave blank to match all)PR DECLINED
Monitored Paths
parameter (leave blank to match all)PR DELETED
Monitored Paths
parameter (leave blank to match all)PR APPROVED
Monitored Paths
parameter (leave blank to match all)branch=$BRANCH
environment=dev;test;prod
boolean=true
Build parameters can be specified using key=value pairs.
You can use predefined variables that will be replaced when the build is triggered.
For example branch=$BRANCH
will replace $BRANCH with the branch name that triggered the build.
Built-in variables:
PR MERGED
triggerParameter Types:
key=value
key=option1;option2;option3
MANUAL
trigger users will be prompted with a dropdown list of the choicesoption1
will be the default for push eventskey=true
MANUAL
trigger users will be prompted with a checkboxtrue
will be the default, use key=false
to make false the default Jenkins Multibranch pipelines can be built directly or through scans. Therefore, if the Multibranch Pipeline checkbox is
selected, REF CREATED
, REF DELETED
, and PUSH EVENT
triggers will cause a scan while all others will trigger a build
for the given branch. Triggers still need to be selected like any other job.