Webhook used to notify Jenkins when commits are made to Stash
Java HTML JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.editorconfig
.gitignore
LICENSE
README.md
checkstyle.xml
pom.xml

README.md

Maintenance and support for this plugin has now been taken over by Mohamicorp. Please use our issue tracker here to create any issues or support requests.


Bitbucket Server Webhook for Jenkins

After making commits to Bitbucket Server (previously known as Stash), notify Jenkins that a new build has been created.

Requirements

  • Git Plugin - Jenkins needs to have the Git Plugin installed in Jenkins and the Poll SCM option must be enabled

Setup

Once installed, follow these steps:

  • Navigate to a repository in Bitbucket Server.
  • Hit the Settings link
  • In the left-navigation, hit the Hooks link
  • For the Stash Webhook to Jenkins, click the Enable button.
  • Enter the URL to your Jenkins instance
  • Select the method that clone method that Jenkins is using (HTTP or SSH).
  • If using HTTP, enter the username that Jenkins is using to clone your repository.
  • Submit the form.
  • Commit some code and watch it trigger a build!

Troubleshooting

  • Check your log file for any exceptions
  • Be sure you have polling turned on for your project in Jenkins (just enable it... the schedule can be empty)
  • Verify that the URLs for your repository match in Jenkins and the webhook settings. They MUST be identical.
  • Still stuck? Check out the this wiki page or open an issue

Rate the Plugin

If you found this plugin useful, please consider leaving us a rating on our Atlassian Marketplace listing. Thanks!

Release Notes

Version 3.0.1

  • Fix to XSRF bug in Trigger Button (thanks JonMR for the PR)
  • Fix sha1 for test triggers and prevent sha1=null in URLs (thanks SuperTux88 for the PR)

Version 3.0.0

  • Updated support for Bitbucket Server (previously known as Stash)

Version 2.7.1

  • Fixed regression with branch parameter when using "Trigger Build" button on PR page
  • Add option to disable trigger button on PR page

Version 2.7.0

  • Restored pull-request notification
  • Make option to include/exclude branch information in Jenkins notification

Version 2.6.0

  • Added ability to not send commit hash in Jenkins notification
  • Reverted pull-request notifications back to where it was before

Version 2.5.1

  • Fixed a Javascript error when opening plugin settings
  • Added datacenter compatible flag

Version 2.5.0

  • Git Plugin version 2.0.2 or greater in Jenkins is highly recommended
  • No longer requires polling to be enabled for the git repository in Jenkins setup (REVERTED)
  • Added more metadata in webhook notification to Jenkins, including the sha1
  • Allows "Trigger Build" button to trigger a build multiple times

Special shoutout to loa for his pull request, work, and patience

Version 2.4.2

  • Fixed syntax error in Javascript for the "Trigger Build" button (thanks dojcsak for the pull request)

Version 2.4.1

  • Stash 3.0 support

Version 2.4.0

  • Added ability to whitelist or blacklist specific branches for triggering of Jenkins. (whitelist = branch HAS to be in list to trigger; blacklist = branch is IGNORED if in the list)

Version 2.3.1

  • Move Jenkins event notification off to its own thread pool to prevent Stash's event thread from blocking (thanks charleso for the pull request)
  • Fixed compatibility issue with versions of Stash before 2.8 (thanks xuey90 for the pull request)

Version 2.3.0

  • Created more helpful error messages during testing of the webhook on the configuration screen.

Version 2.2.2

  • Fixed NPE that occurs when event has a null user. Was seen using the SVN Mirror plugin.

Version 2.2.1

  • Fixed bug in which notifications no longer were sent when pull request is merged

Version 2.2

  • Added button to Pull Request page to trigger a build. Note that Jenkins will still only build if there is an actual change to build.

Version 2.1

  • Trigger webhooks when pull requests are opened, reopened, or updated (thanks stupchiy for the research and lordmatanza for the pull request)

Version 2.0.1

  • Fixed bug in which non-admin users were unable to access webhook settings

Version 2.0

  • Made setup of the Jenkins repository easier by adding SSH/HTTP quick select
  • Fire notification after pull-requests have been merged
  • Added a plugin logo
  • Added test button to the Hook Configuration display
  • Added ability to not send notifications if commits/merges are made by specified Stash users
  • Requires Stash 2.3.0
  • Renamed plugin to Stash Webhook for Jenkins

Version 1.1

  • Added an option to "Skip SSL Certificate Validation", allowing for plugin to communicate with Jenkins instance using a self-signed cert (setting is on Hooks settings for each project)
  • Handle Jenkins urls with trailing slashes more gracefully (thanks ellingbo)

Version 1

  • Initial release