2 years ago

#73987

test-img

tooEarlyToGetUp

BitBucket Webhook for Jenkins isn't triggering build

Ok, I know, there are a lot of questions around already for that topic, but they didn't seem to work with me. Let me summarize the needs and what I tried so far:

Jenkins shall build myRepo whenever there is a Pull Request opened, or when there are changes pushed to a branch with a Pull Request.

So I created a Multibranch Pipeline Project with a Jenkinsfile in myRepo. When saving the project, all expected branches and Pull Requests are discovered and the build is running fine, build results are posted to BitBucket and displayed here. Builds can be triggered manually. So at least that works.

What doesn't work is the automatic triggering of a build, when there are changes.

What did I try so far:

  • I added a Webhook in BitBucket, URL https://my-jenkins.com/bitbucket-webhook/ and checked the items Repository - Push, Pull Request - Opened and Pull Request - Source Branch Updated. On checking the connection, 200 - success is returned. I played around with the URL and if I change that to the Jenkins projects URL, the response is a failure. The webhook status tells me meanwhile, that it sent out dozens of requests, but I didn't see a single build triggered so far.
  • I added Post Webhook in BitBucket with the same URL and checked the events Repository - On push, Pull request created, Pull request updated.
  • In Jenkins project configuration, I put a checkmark on "Build when a change is pushed to BitBucket" and even added the URL of myRepo to the line after the checkmark alone didn't do the trick (https://my-bitbucket.com/myowner/myrepo.git, which is the https-clone URL).
  • In Jenkinsfile I added a triggers section to the pipeline with pollSCM ('* * * * *', yes that should poll every minute, well, it should...)

The Jenkins server we use is externally maintained, so installing new plugins is really hard

Any suggestions on how to solve this?

jenkins

jenkins-pipeline

bitbucket

0 Answers

Your Answer

Accepted video resources