News ticker list | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
...
Setting the JVM switches -Dhudson.model.ParametersAction.keepUndefinedParameters=true and -Dhudson.plugins.git.GitStatus.allowNotifyCommitParameters=true. This will allow arbitrary notify commit parameters (reference). Only enable this if you trust all unauthenticated users to not pass harmful arguments to your jobs.
Setting the JVM switch -Dhudson.plugins.git.GitStatus.safeParameters=PARM1,PARM1. If this property is set to a comma separated list of parameters, then those parameters will be allowed for any job. Only set this value for parameters you trust in all the jobs in your system.
For detailed instructions on adding Java arguments to Jenkins, see CloudBees guide here.
Usage
Bitbucket Server
Go to your hook settings, then go to Webhook to Bitbucket for Jenkins → Advanced Configuration → URL Parameters → Parameters.
Enter the URL parameter into the parameter box. The rules for the parameters are as follows:
The formatting for the url parameter is DESIRED_VARIABLE_NAME={PARAMETER_NAME}.
Every parameter must start on a new line
Name your parameter whatever you'd like, this is how you're going to reference the parameter in Jenkins. In our example we're going to name the parameter e.g. TARGET_BRANCH.
To pull information from Bitbucket to use as a parameter (like the branch name), look at the table below and put it on the right side of the equal sign and surround it with curly braces, e.g. {BRANCH}
If you want to put your own custom value, just eliminate the curly braces and put the value at the right side of the equal sign.
...
Note |
---|
Please note, that you cannot use additional parameters together with Omit SHA1 Hash Code option enabled with Git endpoint - this case is not supported on Jenkins side, see details here. |
Jenkins
To be able to access the parameter in your Jenkins job do the following:
...