Linked repository change detection file pattern not working
Asked by Jonas Gucu:

Hi,

I have a linked repository with 3 folders in it.

I'd like to make 3 different build plans for those 3 folders.

I'm trying to make it so Bamboo only triggers build on pull request for Folder2, but no pattern works.  

"Include only changes that matches to the following pattern"

Folder2/

/Folder2/

Folder/.\*

Folder2\*

etc, etc.  

Is this feature just broken? What I doing wrong?  
Should we use .yaml instead?

Thank you.


Answers:
author: Jonas Gucu
body: Hello, I still need help and support with this.


author: Eduardo Alvarenga
body: Hello [@Jonas Gucu](/t5/user/viewprofilepage/user-id/5119834)

Welcome to **Atlassian Community**!

You need to use a [regular expression](http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html) for that to work. E.g:

* **\^Folder2\\/.\***

The regex above will match any commits made to any files at any level from the "Folder2" folder.

More interesting examples here:

* <https://community.atlassian.com/t5/Bamboo-questions/Bamboo-YAML-specs-multiple-plans-of-on-repository-Change/qaq-p/2185094>

Sincerely,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**

comments: author: Jonas Gucu
body: Hello,  

This does not work.

I make changes to a file in Folder1, make a pull request, but the build for Folder2 gets triggered.


author: Eduardo Alvarenga
body: Hello [@Jonas Gucu](/t5/user/viewprofilepage/user-id/5119834)

Sorry to hear it is not working for you, but ++it does work++ if configured correctly.

You will have to review the repository and trigger settings on each Plan and confirm if they are all pointing to the same Repository in Bamboo.

If they all share the same repository and that repository has specific Change Detection options with include patterns, it should work.

Regards,

Eduardo Alvarenga  
Atlassian Support APAC  
**--please don't forget to Accept the answer if the reply is helpful--**


author: Jonas Gucu
body: Hello again,

I double-checked everything.

There are 2 linked repositories pointing to the same bitbucket repository.

The repository contains 1 solution with 3 folders. The first two folders contain UI projects with other class library projects.

In one of my linked repositories I have written a Change detection option -\> File pattern like the one you have written above **\^Folder2\\/.\***

I checked plan configurations for both repositories. Both of them have triggers, look at the appropriate linked repository and "Create plan branch" is set to "When pull request is created".

I change a class file in **Folder1** , make a Pull Request and BOTH of the plans get triggered, even though the second plan has a file pattern that should only trigger when something in **Folder2** gets changed.

So it does not work. Can you suggest what else I should check? Is this something wrong with Bamboo version, or configuration, or anything else?

We are using "Atlassian Bamboo version 8.0.0 build 80008 - 29 Jul 21".


author: Eduardo Alvarenga
body: Hello [@Jonas Gucu](/t5/user/viewprofilepage/user-id/5119834)

Thank you for the detailed explanation. The issue is not related to the Regex or Change detection options. As you have explained better, you are creating a **Pull Request**. Bamboo will run a build regardless of any settings when it receives a notification for a new PR.

Please have a look at the following Community thread for a workaround and also a Feature request where you can vote so our developers can be aware of what needs to be implemented.

* <https://community.atlassian.com/t5/Bamboo-questions/How-to-disable-build-trigger-with-new-branch-creation/qaq-p/2155782>

Cheers,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**


author: Jonas Gucu
body: Hello [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410)   
Sorry for not writing a detailed explanation at first :)  

I don't see how that thread helps me to be honest.  

So what are the change detection options for then? And is there no way to achieve what I'm trying to do?


author: Eduardo Alvarenga
body: Hello [@Jonas Gucu](/t5/user/viewprofilepage/user-id/5119834),

Running the first build when a Plan Branch is created is Bamboo's expected behaviour and there is no way to prevent that from happening.

That is documented on the <https://jira.atlassian.com/browse/BAM-12944> feature request which you can watch and vote on to have it implemented.

As explained on the linked [community thread](https://community.atlassian.com/t5/Bamboo-questions/How-to-disable-build-trigger-with-new-branch-creation/qaq-p/2155782), you can add a "dummy" task as the first Task to the First Job of your Plan and use it as a workaround to avoid the full build from happening when you create a pull request and consequently the Plan branch is created.

Any other pushes to the same branch that is part of the same Pull Request will be avoided by the Repository's Change detection options and their Regular expression includes/excludes.

Regards,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**


author: Jonas Gucu
body: Hello,

So as I understand there is no way to achieve what I want.


Tags: change

deployment

file

pattern

plan

publish

repository