1
votes

I have a use case where I want to trigger a specific Jenkins job from a BitBucket pull-request via a webhook.

I have managed to get this working using the Bitbucket Pull Request Builder Plugin. However, this plugin only allows me to link one BitBucket repository to trigger my job, when I want to allow multiple repositories to trigger this job.

After doing some digging, I discovered that I could use the Multiple SCMs Plugin to specify all of the repositories that I want to trigger the job. However, the Multiple SCMs Plugin does not expose what GIT_COMMIT from which repository triggered the job.

Is there any way to either:

  1. Use the Bitbucket Pull Request Builder Plugin (or similar) to specify more than one repository to trigger from.
  2. Get the Multiple SCMs Plugin (or similar) to expose the GIT_COMMIT and repository that triggered the job?

I am currently limited to running an older version of Jenkins 2.106, on Linux.

1

1 Answers

1
votes

I had same problem. I wanted to use web-hooks for my project, but it appeared that our infrastructure is so "secured" that web-hook's communication was blocked by security setup (Csrf issue). So I changed approach and create trigger job on repoX that can change.

project-build-trigger - freestyle job that points to repoX, with pool SCM (cron: 0/3 **** - check each 3 minutes), and build when pushed to BitBucket

project-deployment - full pipeline job that points to repoY with option "build after other projects are build" (under Build Triggers) and set there project-build-trigger (You cans set here other projects like: some library build job, some other jobs etc.)