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

DSL unable to set auto branch management strategy #58

Closed lseek closed 7 years ago

lseek commented 7 years ago

Hi,

Firstly, great plugin - helped us recover from disasters a few times :).

I've run into a problem with the branch management strategy of a build plan where the strategy is NOT being set.

For example I create a seed task with the following inline script:

project(key: 'DEV', name: 'DEVOPS') {
    def newPlan = plan(key: 'BRANCHTEST', name: "branchtest.tests") {
        description 'Test branch management'
        enabled false

        scm {
          linkedRepository('testrepo')
        }

        branches {
            autoBranchManagement {
                newPlanBranchesForMatchingBranchNames('review/.*')
                deletePlanBranchesAfterDays(5)
                deleteInactivePlanBranchesAfterDays(3)
            }
            merging {
                branchUpdater {
                    mergeFromBranch "DEV-BRANCHTEST"
                    pushEnabled true
                }
            }
        }

        stage(name: 'Default Stage') {
            description 'Run Tests'

            job(key: 'JOB1', name: 'Run test') {
                description 'Run Test'
                enabled true

                tasks {
                    checkout {
                        description 'Checkout Default Repository'
                        repository(name: 'testrepo') { }
                    }
                    script {
                        description 'Run test'
                        inline {
                            scriptBody '''\
                              #!/bin/bash

                              echo Testing'''.stripIndent()
                        }
                    }
                }
            }
        }
    }
}

When I run this seed plan it creates the new build plan but the branch management strategy is set to "manual".

Bamboo version: 6.1.0 build 60103 - 18 Jul 17 Plugin version: 1.9.1

NOTE: The auto branch management was working fine until we switched from Bamboo 5.14.5 build 51419 - 10 Mar 17 to 6.1.0 build 60103 - 18 Jul 17 yesterday.

I tried setting the other strategies in the seed task code and observed the following:

For now we've reverted back to the old version but that's only a temporary measure ... we need to upgrade to the new version sooner rather than later.

Any help is appreciated. Thanks.

mrueegg commented 7 years ago

Hi @lseek

Thanks for bringing this up! You're right, I was able to reproduce this issue with Bamboo 6.1.

I've fixed this now and will ship the bug fix with the next release coming very soon (hopefully this week).

I'll report back here once it is out!

Best regards, Michael

mrueegg commented 7 years ago

We have fixed this with the latest release 1.9.2. Thanks again for bringing this up!