mibexsoftware / bamboo-plan-dsl-plugin

Configuration as code with a Groovy-based DSL or YAML for Atlassian Bamboo.
https://marketplace.atlassian.com/plugins/ch.mibex.bamboo.plandsl/
Other
40 stars 16 forks source link

Issue with the use case "Create develop branch plan, if already exists" #34

Closed muchino closed 7 years ago

muchino commented 7 years ago

Hi

Hi like to create a develop branch plan, if the branch exists. My code is

 branches {
                                autoBranchManagement {
                                    createPlanBranchesForNewPullRequests()
                                    deletePlanBranchesAfterDays(7)
                                    deleteInactivePlanBranchesAfterDays(14)
                                }
                                if (MyUtility.hasDevelopBranch(repo.project.key, repo.slug)) {
                                    branch("develop") {
                                        enabled true
                                        overridePlansDefaultRepository {
                                         branchName "develop"
                                        }
                                    }
                                }

                            }

Before I added the overridePlansDefaultRepository property, the branch plan was created next to the master plan. But with the issue that the develop branch plan used the master branch instead of the develop branch. Then I found in your code the overridePlansDefaultRepository property and thought "great" ;)

I changed the code as shown above, but now I retrieve an error after the code generated the plan and I click on repository on the develop branch plan.

Any ideas what I've done wrong?

Thank you for your thoughts :-)

image

mrueegg commented 7 years ago

Hi,

Thanks for your feedback. You're right, I was able to reproduce this behavior with Bamboo 6.0.0. This only seam to happen if we first create a plan branch without the overridePlansDefaultRepository block and then edit it with this block.

We will fix this for the next release of the plug-in. In the meantime, a workaround is to manually delete the plan branch and then run the seed DSL with the overridePlansDefaultRepository block.

Cheers, Michael

muchino commented 7 years ago

Hi Michael

Awesome - feedback on the weekend :-)

Because I have 200 repos, I wait for a fix instead of edit every single repos. Or ist it hard to fix so that I should do it anyway ;)

Thanks Oli

mrueegg commented 7 years ago

Hi Oli,

I think the easiest thing to do would be to delete all plan branches which were not created with the overridePlansDefaultRepository and re-create them by running the seed DSL task.

The current version of the plug-in does not export the necessary Bamboo services, but with the next release it will be possible to run

planManager.allPlans.each { plan ->
  chainBranchManager.getBranchesForChain(plan).each { planBranch ->
     deletionService.deletePlan(planBranch)
  }
}

Note that this will delete all plan branches of all plans on your Bamboo instance (you probably only want to do this for the plan branches not created with overridePlansDefaultRepository).

If you are interested, please send us an e-mail and we will send you a SNAPSHOT of the upcoming version which supports this.

Cheers, Michael

muchino commented 7 years ago

Sounds interesting. Feel free to send a version to Oliver.straesser@bitvoodoo.ch. But I cant test it the next days, so it is not urgent.

Thanks Oli

Am 05.06.2017 01:58 schrieb "Michael Rüegg" notifications@github.com:

Hi Oli,

I think the easiest thing to do would be to delete all plan branches which were not created with the overridePlansDefaultRepository and re-create them by running the seed DSL task.

The current version of the plug-in does not export the necessary Bamboo services, but with the next release it will be possible to run

planManager.allPlans.each { plan -> chainBranchManager.getBranchesForChain(plan).each { planBranch -> deletionService.deletePlan(planBranch) } }

Note that this will delete all plan branches of all plans on your Bamboo instance (you probably only want to do this for the plan branches not created with overridePlansDefaultRepository).

If you are interested, please send us an e-mail and we will send you a SNAPSHOT of the upcoming version which supports this.

Cheers, Michael

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mibexsoftware/bamboo-plan-dsl-plugin/issues/34#issuecomment-306076141, or mute the thread https://github.com/notifications/unsubscribe-auth/ABM9tcVH4uom_VWvOj4Cgpsi_Dy0n5Xvks5sA0SNgaJpZM4NvDkO .

mrueegg commented 7 years ago

Hi Oli,

I hope that I can ship this version to the Marketplace within the next few days, so if it's not urgent on your side you can use the official version then :-) Otherwise, I'll let you know.

Cheers, Michael

muchino commented 7 years ago

Yes that's absolutely fine for me. Thank you for your great support

mrueegg commented 7 years ago

DeletionService is now exported with version 1.8.0 of the plug-in. Please try now with the provided example.