I use webhooks on Bitbucket to run the build on Jenkins when the push event occurs, for this I use the Bitbucket plugin. My Jenkins pipeline consists of several cross-dependent tasks, for example:
Main pipeline (running task)
- 1) build docker images
- 2) run tests
- 3) do something
The build starts when it is expected, but the tasks fail because they rely on the specific branch that I need to provide. Unfortunately, I do not know how to access the webhook payload, which has all the information I need.
An alternative would be to use the Poll CMS option in Jenkins, but I prefer to build on demand rather than periodically.
source share