August 10, 2021Configuration as code is available in Bamboo and this feature is called Bamboo Specs. Configuration as code allows the entire configuration of Bamboo plans to be stored as source code. It moves the management of plans from the Bamboo UI to the developer's integrated development environment (IDE), and this approach brings a lot of benefits.
Bamboo SpecsThe Bamboo Specs allow you to define plan configuration as code and send it to Bamboo to have corresponding plans created or updated automatically. In case you are looking for detailed documentation about a specific method or class, you can find it in Bamboo Specs API Our Bamboo Specs tips:
- Use script tasks wherever possible as they are easier to test locally compared to Bamboo tasks
- Use the Bamboo specs plan exporter (Plan configuration -> Actions -> View Plan as Java Specs) to get a working spec instead of starting from scratch
- Before publishing the specs with `mvn -Ppublish-specs`, do an offline test beforehand with `mvn test`.
- Store your specs version-controlled in Bitbucket and use PR's for code review when they need to change
In order to export an existing build plan to Bamboo Specs source code:
- If you don't have a Bamboo Specs project, create one
- Go to your build plan and select Actions > Configure plan
- On the plan configuration page, select Actions > View plan as Java Specs
- Copy generated Java code to your code editor by putting it in the PlanSpec#createPlan method for instance