Story
We have been on a DevOps journey with Plan Creation Scripting for almost 2 years to realize the goal of having Bamboo configuration as code. Internally, we have 100's of plan configurations under source control with the ability to deploy them to multiple Bamboo servers in an instance. It has proven to be an highly productive endeavor. We made the investment to create these script from scratch and, in the process, significantly improved the performance and reliability of our builds. We are probably on our 3rd generation of major improvements in our plan construction including standardization, common elements, support tools, and more maintainable scripts.
Now there has been a major advances with Bamboo CLI 6.4 with the addition of exportPlan and the ability to kick start configuration from source efforts in your company as you accelerate your DevOps journey.
Atlassian Endorses Configuration as Code for Bamboo
With Bamboo 6.0, has made the initial steps to support Configuration as code with the release of Java based configuration source. They have articulated the advantages of this approach - Advantages of Configuration as Code.
Options
Source | Bamboo | Advantages |
---|---|---|
Java | 6.0 and higher |
|
CLI | 5.10 and higher |
|
Export Existing Plans
Whatever option you choose, the new Bamboo CLI exportPlan action can help you with your journey and automation.
EAP - exportPlan is marked experimental in 6.4
- Atlassian considers export to java as beta for Bamboo 6.0 - export may be incomplete or not able to be imported without changes
- Export plan to CLI is new in Bamboo CLI 6.4 and has some limitations as well in terms of completeness that will be addressed mostly in release 6.5
--action exportPlan --plan EXAMPLE-PLAN --type java --file example.java
--action exportPlan --plan EXAMPLE-PLAN --file example.txt
Export All Plans With One CLI Action
One action will export all your existing plans to a directory. Alternatively, be more selective by doing this by project and using regex based filtering on names.
--action runFromPlanList --project @all --common "--action exportPlan --plan @plan@ --type java --file export/@project@/@plan@.java" or --action runFromPlanList --project @all --common "--action exportPlan --plan @plan@ --file export/@project@/@plan@.txt"
Import - Creating or Updating Plans
For java, use your IDE of choice and refer to the Atlassian documentation.
For CLI, use one of the following approaches depending on your situation.
--action run --file example.txt
--action run --file example.txt --findReplace "--plan EXAMPLE-TEMPLATE:--plan EXAMPLE-PLAN1, --name TEMPLATE:--name Plan1"