News ticker list | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
Webhook to Jenkins for Bitbucket version 4.2 and higher support sending custom job parameters to Jenkins during the notification/trigger process adding them to notified Jenkins URL. To use this feature, you must also configure Jenkins to allow parameters.
...
Configure Bitbucket Server
Log in to your Bitbucket repository and navigate to Repository Settings > Hooks > Enable or click the Edit setting for Webhooks to Jenkins Server icon.
Click the Advanced Configuration taband locate Job Parameters at the bottom of the dialog.
Enter the job parameter into the parameter field. The rules for the parameters are as follows:
The formatting for the parameter is
DESIRED_VARIABLE_NAME={PARAMETER_NAME}
.Every parameter starts on a new line.
The name given to your parameter is how you reference the parameter in Jenkins. In our example the parameter name is
TARGET_BRANCH
.To pull information from Bitbucket to use as a parameter (like the branch name), refer to the Available parameters section and enter the parameter on the right side of the equal sign surrounded with curly braces
{BRANCH_NAME}
.To use your own custom value, eliminate the curly braces and enter the value to the right of the equal sign.
...
Note |
---|
You cannot use additional parameters together with the Omit SHA1 Hash Code option enabled with Git endpoint. This case is not supported on the Jenkins side. |
...
To access the parameter in your Jenkins job:
Go to your job, click Configure from the left sidebar and go to the General tab. Select This project is parameterized.
click Add Parameter and select String Parameter
in the Name field, enter the name of the parameter that you used in the Webhook to Jenkins Job Parameters field.
For each additional parameter, click Add Parameter, select String Parameter and enter the name of the next parameter.
Click Save.
Your parameters should now be passed to Jenkins.
...