- Open your jenkins project
- configure it to use: Poll SCM (but leave the schedule blank)
- save and exit
in Bitbucket / Github create a web hook and enter the following url (replacing your jenkins & git project details)
http://<your domain>/jenkins/git/notifyCommit?url=<your git repository url>eg
http://fakewebsite.com:8080/jenkins/git/notifyCommit?url=git@bitbucket.org:faceuser/fakeproject.git
This will do the following:
- Send a web hook request to your jenkins
- Jenkins will process this request and look for Jenkins projects using the specified gitproject (e.g. git@bitbucket.org:faceuser/fakeproject.git)
- Jenkins will then poll git looking for changes on the specified branch