You have two great tools that you’d like to integrate. In this case, you’re using BitBucket and Jenkins. You can configure Jenkins to check BitBucket for changes(aka polling) to make a build. But this is clunky and repetitive.
There is a better way. BitBucket offers a plugin called “Webhook to Jenkins for Bitbucket“. This plugin calls Jenkins for each new commit to a repository. This way Jenkins doesn’t call BitBucket, BitBucket calls Jenkins. It’s The Hollywood Principle, “Don’t call us, we’ll call you”.
Now like so many times in programming, your solution to one problem has created another. In debugging, this is progress. You need to know how to stitch this together. You’ll be able to configure it by clicking Edit (the pencil icon) to bring up the below screen. Once you enter all the information, click
Trigger Jenkins to test the connection. You may see the following error.
Temporary failure in name resolution
You may need to provide with the fully qualified domain name for the Jenkins instance. The machine name alone will not work(e.g.
awesome_machine). You need to enter the fully qualified machine name in the Jenkins url. Assume the fully qualified machine name is awesome_machine.awesome.domain. This would make your url look like
http://awesome_machine.awesome.domain:3456(assuming the port is 3456). Once you do that, you’ll get a new error.
New Problem (Again!)
Once you click
Trigger Jenkins, you may get an error stating
No Git jobs using the repository.
New Solution (Again!)
To work around this, you can configure the trigger for the job to poll the scm without a schedule. You can do this by clicking
Poll SCM and leaving the
Schedule text area blank. You can see an example below.
It’s important to note that despite the above setting, Jenkins will never poll Git.
- Github: Debugging “Error: Jenkins Response: No git jobs using repository” #147
- Webhook to Jenkins for Bitbucket