Repository parent can not be changed or Changing repository hierarchy is not supported

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The user gets the following error when commit change to Repository with Bamboo Specs:

1 Changing repository hierarchy is not supported.

Diagnosis

We can see the following message in the atlassian-bamboo.log file:

1 2 3 4 5 6 7 8 13-Jul-2021 13:16:12 com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: planRepository / two git repo: Repository parent can not be changed. 13-Jul-2021 13:16:12 java.lang.IllegalArgumentException: com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: planRepository / two git repo: Repository parent can not be changed. 13-Jul-2021 13:16:12 at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$validateAndCreateRepositoryObjects$21(PlanConfigImportServiceImpl.java:1261) 13-Jul-2021 13:16:12 at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:129) 13-Jul-2021 13:16:12 at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.validateAndCreateRepositoryObjects(PlanConfigImportServiceImpl.java:1235) 13-Jul-2021 13:16:12 at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$modifyTopLevelPlanFunction$2(PlanConfigImportServiceImpl.java:556) 13-Jul-2021 13:16:12 at com.atlassian.bamboo.core.ScopedExclusionServiceImpl.tryWithLock(ScopedExclusionServiceImpl.java:74)

Cause

Bamboo prevents changing of repository hierarchy to prevent plan branches damage. When linked or project repository is added to plan Bamboo creates copy and link it with original repo which is referenced at "parent". Then if "parent" configuration changes then all children will use new settings. With Bamboo Specs code you can configure plan to use linked repository "Some linked repo"

1 2 Plan plan = new Plan(project, "Test", "TEST") .linkedRepository("Some linked repo");
1 2 3 4 5 6 7 8 version: 2 plan: project: project name: Test key: TEST repositories: - Some linked repo

But if you decide to change sample plan with code like this Bamboo will raise validation error to not break your plan branches as plan repo might have different URL and other settings than linked repo has.

1 2 3 4 Plan plan = new Plan(project, "Test", "TEST) .planRepository( new GitRepository().name("Some linked repo").url(some_url) )
1 2 3 4 5 6 7 8 9 10 version: 2 plan: project: project name: Test key: TEST repositories: - Some linked repo: type: git url: some_url

Solution

If you really want to change repository hierarchy, try to make it in two steps. First make change to plan configuration and remove all repos, commit change. Then add repository from another level e.g. linked, project or plan and commit your changes

Step 1

1 Plan plan = new Plan(project, "Test", "TEST");
1 2 3 4 5 6 7 version: 2 plan: project: project name: Test key: TEST repositories: []

Step 2

1 2 3 4 Plan plan = new Plan(project, "Test", "TEST) .planRepository( new GitRepository().name("Some linked repo").url(some_url) )
1 2 3 4 5 6 7 8 9 10 version: 2 plan: project: project name: Test key: TEST repositories: - Some linked repo: type: git url: some_url

Updated on February 25, 2025

Still need help?

The Atlassian Community is here for you.