Trigger branch-plan only on changes in specific repository sub-folder

Markus Denner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 2, 2020

I have the following problem and can't find any solution for it:

Our repository contains multiple C# Solutions and we are using pull-requests to bring new code into develop/master.

The target I want to achieve is the following:

  • Multiple builds, one for each solution inside the repository
  • A build is only triggered, if where are changes inside the solution sub-folder
  • When someone pushes a feature-branch and creates a pull-request, all build for all Solutions with changes are triggered and executing the UnitTests for these solutions

I configured my default-plan as follow:

  • The repository is set to our repository on the Bitbucket-Server, default branch is develop
  • In the repository settings I added "Change detection options" and add a RegEx to the Subfolder of Solution 1
  • Trigger of the default-plan is set to "Bitbucket Server repository triggered", using the repository settings described above
  • The branches options are configured to create a new plan "When new branch in repository is created"
  • The triggers of the branch-plan is set to "Same as defined in parent plan"

I expect the following:

  • A developer wants to bring a new feature containing changes for Solution 1 into develop and creates a pull-request
  • The feature-branch is pushed to server and a pull-request will be created
  • As there are changes in Solution 1, the build for Solution 1 is triggered, the build for Solution 2 NOT
  • After the build and all tests of Solution 1 are passed, the pull-request can be merged

Unfortunately it doesn't work as I expect, because on branch-plan creation (at the moment the feature-branch is pushed to the repository), the branch-plan build is triggered, doesn't care if where are changes in Solution 1 or not.

When the developer pushes new changes in the existing branch, it works as I defined and expected (so only changes in Solution 1 triggers the build), but this first build on branch-plan creation is a problem I can't solve... is where some solution how I can handle this?

2 answers

1 vote
Michal Zastocki
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 23, 2023

I know it is old thread but is there any solution for this case?

I think about add some script as the first job in every plan which would check whether change was made in specific directory but this is really weird way. 

0 votes
Robson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 29, 2024

indeed features very well covered by others known tools. It should have that feature already available.

 

Does anyone has an workaround?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events