0

I'm using Jenkins 2.209 with Bitbucket server 7.12.0 latly we changed to a multibranch pipeline I've notice that when a PR is approved and merged into main all the other open PR's that targeting main are triggered. Is there a way to tell jenkins not to trigger the PR when there is a change in the target branch?

Eldar
  • 65
  • 1
  • 4

1 Answers1

0

There are multiple ways;

On the side of Bitbucket; you can take a look at what (web)hooks are set on a repo/project (via Repository Settings).

More likely; If you use the Bitbucket plugin on Jenkins, I believe you can change the way PR's are build, per job config. Try setting Config -> Branch Sources -> Bitbucket -> Behaviours -> "Discover pull requests from origin" to "The current pull request revision"; or test with any of the additional "Behaviours"

But, to close off with; do you really want to do that? You may encounter that a PR is stable on the moment as it is created; but unstable after a while if the target has changed. Bitbucket will still show you the old green check-mark, and may fool you in a false sense of merge-security. It might be better if you let them run automagically. If versioning is the source of the headache; I would recommend a look at tools like Jgitver (for Java) to build versioning on the base of a git tag and/or (commit distance) instead of a pom.xml like file

Sir.Chefcoq
  • 330
  • 1
  • 7