Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
News ticker list
displayTime5000
color#46A7DE
width100%
titleOther powerful plugins from Mohami

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

  1. Log in to your Bitbucket repository and navigate to Repository Settings > Hooks > Enable or click the Edit setting for Webhooks to Jenkins Server icon.

  2. Click the  Advanced Configuration taband locate Job Parameters at the bottom of the dialog.

  3. 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:

  1. Go to your job, click Configure from the left sidebar and go to the General tab. Select This project is parameterized.

  2. click Add Parameter and select String Parameter

  3. in the Name field, enter the name of the parameter that you used in the Webhook to Jenkins Job Parameters field.

  4. For each additional parameter, click Add Parameter, select String Parameter and enter the name of the next parameter.

  5. Click Save.

Your parameters should now be passed to Jenkins.

...