We have a lot of very similar build plans in our company's Bamboo instance. Keeping them in sync is very hard and error-prone.

We once decided to tag the latest commit of a new release whenever we ship our software to production. Adding the necessary build task to achieve this to all our build plans was a huge effort because we basically had to click through the configuration UI of every build plan. Also, we didn't have the possibility to rollback our configurations to a specific state and we couldn't see what has changed since the last working configuration. This was the point where we decided to build this plug-in.

What it does

This plug-in is similar to the well-known Job DSL plug-in for Jenkins. It allows you to specify your build plan configurations with a Groovy-based DSL. Simply specify your plan DSL files in your favourite IDE with code completion and documentation, add the plug-ins seed task to a plan and reference the DSL files from your SCM. When you run the plan with the seed task, the plug-in will automatically create and update all plans specified in the DSL files. This allows you to standardize your build plans by treating them as code.

How I built it

I built this plug-in with the Atlassian plug-in SDK and Groovy's 1st class meta-programming capabilities. The DSL files are just ordinary Groovy code with our custom Bamboo plan DSL. We export the most important Bamboo API's so that you can access them in the DSL scripts and create/maintain nearly everything that's possible in Bamboo.

Challenges I ran into

  • Bamboo synchronization issues when creating the build plans were a real challenge. I was able to solve them by creating all the Bamboo entities in a transaction.
  • Getting the integration tests to work with Bamboo was hard as well because I struggled with some AMPS issues.
  • Finding all the possible settings Bamboo provides in its API to offer them in my DSL was quite hard and time-consuming as well.

Accomplishments that I'm proud of

  • The plug-in is able to report the line in the DSL script where the error is located.
  • I'm also proud that the plug-in is able to show the created Bamboo build plans on the build overview page of the seed plan.
  • I also like that the plug-in provides a general interface that makes it possible to use any Bamboo tasks (even the ones not built-in to Bamboo) in the plan DSL.
  • Finally, I really like that you can also enter your DSL in the Bamboo task configuration in a self-provided text editor with syntax highlighting.

What I learned

Quite a lot about Groovy meta-programming and the inner workings of Bamboo

What's next for Plan DSL for Bamboo

  • Support for deployment plans
  • Better documentation and more examples
  • Generating the DSL out of existing Bamboo plans to make it easier to get started
  • Make it open source

Built With

Share this project: