Jenkins Bitbucket Branch Source Plugin how to build only master and PR?

I use Jenkins 2 with the Bitbucket Branch Source Plugin , which scans and builds all branches and PRs.

My problem is that when I click the code on PR, the branch is built twice (one for the branch and one for PR). I would like to build only a master and PR.

Does anyone know how to do this? I can not find documentation about this.

From Branch Indexing Log (with filter):

 Checking branch branch-name from repo/project Met criteria Scheduled build for branch: branch-name ... Checking PR from repo/project and branch branch-name Met criteria Scheduled build for branch: PR-123 

Then, when I try to filter on PR- *, nothing is scanned. I just get:

 Checking branch branch-name from repo/project 
+5
source share
2 answers

When you configure Bitbucket sources, you can use Include branches or Exclude branches (in Advanced options) to enable / exclude some branches:

enter image description here

And based on the source code of the Bitbucket Branch source code , both fields accept Ant regex .

So, if all your PR branches start with " pr - ", you can use the regular expression in Include branches , for example.

 (?:master|pr-).* 
+1
source

You can simply separate your terms with a space. For your attempt, try:

 master PR-* 
+4
source

Source: https://habr.com/ru/post/1257438/


All Articles