On my Jenkins I configured:
Source Code Management
Git repository: https://bitbucket.org/username/project.git
credentials: username/password
Builder Triggers
Build when a change is pushed to BitBucket
On my BitBucket Webhooks:
http://Jenkins.URL:8080/bitbucket-hook
I tried pushing a small change to a .txt file, but the Jenken doesn't build automatically. If I manually click "build now", it shows success.
What could be the problem?
In the bitbucket repository, the project is simple. I just have a text file to test. I think as long as I made any change to the text file, it should trigger a Jenkins build.
Edit:
In the System Log of Jenkins, it shows "Polling has not run yet.". But in Bitbucket Webhook request log, I can see all the requests.
I'm doing the same but without the Bitbucket Plugin in my Jenkins.
I'm using the Jenkins Plugin in my Bitbucket. I've configured the webhook on each repository and pointing with the simply Jenkins URL. Then, into every job that I need, just leave checked the "Poll SCM" with/without schedule (is not required).
With that is working really well and I avoid another plugin installation in my Jenkins.
Did you mark the checkbox where it says: Poll SCM? Also make sure that you schedule a short time to detect the changes in the repository as soon as possible.
Maybe your problem is that you schedule for a long time and after your push Jenkins wait some time to detect the changes.
Had the same issue on Jenkins 2.138.1 with Bitbucket plugin and the problem was that I had to enable "Source Code Management" -> git, otherwise it won't do anything although the webhook appeared on Jenkins's log (/var/log/jenkins/jenkins.log).
You don't need to enable Polling SCM..
You have to ensure that your Webhook (Settings->Webhooks) is pointing to your Jenkins
bitbucket-hook
like the following: "https://ci.yourorg.com/bitbucket-hook/".Notice that last "/", without it, the build will not be triggered.
It's an annoying thing, as you will get a 200 status code from Jenkins when sending requests, with or without it.
As @Adrian mentioned, you still need to select "Poll SCM". It's a little unintuitive, but when the BitBucket webhook sends a request to Jenkins, Jenkins will poll for changes on all jobs that reference the BitBucket repo where the change was made. You can set a long time interval for the poll, e.g. @monthly, as you don't need Jenkins' scheduling to trigger polling; the web hook will take care of that as soon as a change is made.
This needs your Jenkisserver to have the bitbucket plugin. Check it by going to https://yourjenkinsserver.com/bitbucket-hook/ - it will crash, but you will know you installed it.