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

Replacing Triggers Causes Internal Error on Bamboo #50

Closed sohrab- closed 7 years ago

sohrab- commented 7 years ago

I have existing plans with a polling repository trigger. I change the DSL to change it a Bitbucket Server trigger. Bamboo Seed plan runs successfully but the repository polling is not removed and cannot be configured any more (returns HTTP 500).

image

I have replicated this with both Disable and Delete actions in Seed Task. The stacktrace is rather long so I have attached it.

We are running Bamboo 6.0.1 and Plan DSL 1.8.2.

mrueegg commented 7 years ago

Could you please share me the DSL of both the polling trigger and the Bitbucket Server trigger so that I can try to reproduce it? Because I wasn't able to do so yet. Thanks!

sohrab- commented 7 years ago

I am actually migrating plans from a remote Git repo (defined in the plan) and a polling trigger to a Bitbucket Server (as a Linked Repository) and Bitbucket Server trigger.

So from this syntax:

plan {
   scm {
      git(name: repoName) {
         url "${gitBaseSshUrl}/${repoName}.git"
         branch branchName
         sshSharedCredentials 'someCredentials'
      }
   }
   triggers {
      repositories repoName
      periodically {
         pollingFrequencyInSecs 1800
      }
   }
}

to:

plan {
   scm {
      linkedRepository repoName
   }
   triggers {
      bitbucketServerRepositoryTriggered {}
   }
}

This change results in the screenshot and stacktrace I already posted.

PS. Actually the old repos don't seem to go away neither but I assume that's because there is no way to disable old repos defined.

mrueegg commented 7 years ago

You are right, this is because repositories cannot be disabled but only be removed.

Is it possible that you have a syntax error in your polling trigger example? Actually, I think the syntax would need to look like this:

        triggers {
            polling() {
                repositories repoName
                periodically {
                    pollingFrequencyInSecs 1800
                }
            }
        }
sohrab- commented 7 years ago

Ah sorry that was a copy-paste mistake on my part. My syntax does matche yours in my source code. I just had a few re-usable methods I had to expand for the above snippet and missed a line.

image

I can also confirm both old and new DSLs work fine when there is no existing plan. But if there is an existing plan with a working polling trigger, changing it to Bitbucket Server trigger causes the above issue.

mrueegg commented 7 years ago

@sohrab- You are right, I was now able to reproduce and also fix it. The bug fix will be part of the next plug-in release.

mrueegg commented 7 years ago

Bug fix shipped with release 1.9.1. Thanks again for reporting this!