Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Specs - Pull request created plan branch on wrong plan

joshuayhloCW April 26, 2019

Background

I've got a repository in Stash / Bitbucket Server. Let's say it's in a project called FOO, and the repository is named bar. It has a develop and master branch.

In Bamboo Server, I've got a linked repository corresponding to each branch:

FOO / bar / develop
FOO / bar / master

 

I created a Specs (a .java) such that it contains definitions for two plans - one for the develop branch and one for the master branch. I pass the string corresponding to the linked repository to each Plan generator:

public Plan createMasterPlan() {
.linkedRepositories("FOO / bar / master")

...
}

public Plan createDevelopPlan() {
.linkedRepositories("FOO / bar / develop")

...
}

 

Problem

Later on, I decided to add plan branch management to each. However, on the master plan, I specified createForPullRequest and on the develop plan I specified createForVcsBranch.

I also have Stash configured to retrieve Bamboo build statuses and attach them to commits.  While creating a branch in Stash creates a plan branch on the develop plan as expected, pull requests to develop create a plan branch on the master plan. 

I'm not particularly sure how to explain this behaviour. I'd like for pull requests to develop to not create a plan branch for master. I assume this happens because of the mismatched plan branch management definitions. Can anyone confirm? Anyone else seen behaviour like this before?

 

EDIT

I just changed the plan branch management definitions in my Specs to use createForPullRequest for both.

Apparently this has the same problem: the pull request I create causes two plan branches to be created - one for develop, one for master.

1 answer

1 accepted

1 vote
Answer accepted
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 1, 2019

Hi @joshuayhloCW

Firstly, thank you for your detailed issue description of this question.

Moving to the answer part, I have to say that this is the expected behavior. The createForPullRequest configuration will create a new plan branch for any pull request submitted to a plan that references the source repository affected. In other words, if you create a pull request to develop or any other branch, all plans referencing the affected repository will get a new plan branch.

Linked repository clarification

The branch you use for a linked repository will only define what will be the default branch for that plan. It will not restrict the plan branch creation to that branch. This is the same behavior you see when you configure both plans to createForVcsBranchand create a new branch, which will create the new branch in both of them.

Feature requested

We have a couple of users that see this as a limitation in the pull request feature and therefore created a feature request to add a regex expression to this feature so you can decide in which conditions the pull request would be created. A similar feature already exists to createForVcsBranch option. This is the one:

There is no workaround for this at the moment. If you cannot have pull requests from other branches created in that same plan, the only option I see is disabling the createForPullRequest feature.

I hope I was able to clarify this scenario.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events