Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
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
Finer grained access for more complete and complex requirements
Supports modular components to help enable standardization and reuse
Better suited for teams with Java programming and IDE skills
CLI
5.10 and higher
Higher level abstraction - more readable
Same syntax as dynamic plan modifications and related automation
Supports modular components to help enable standardization and reuse
Individual actions enable better problem determination
Option to continue past individual errors on plan creation or modification
Better suited to DevOps teams and those comfortable with command line usage
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. The CLI exportPlan uses the Bamboo provided export for java.
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.
# Exported from https://examplegear.com running Bamboo 6.0.0 on 2017-05-02 by automation using the Bamboo CLI 6.4.0-SNAPSHOT
-a createOrUpdatePlan --plan ZEXPORT-BASE --name "Base" --description ""
-a removeRepository --plan @plan@ --repository @all
-a addRepository --plan @plan@ --repository "cli"
-a removeBranch --plan @plan@ --branch @all
-a addBranch --plan @plan@ --branch 2.5.0 \
--name "ZEXPORT - Base - 2.5.0"
-a removeVariables --plan @plan@ --field1 @all
-a addVariables --plan @plan@ --field1 "v1" --value1 "xxx"
-a removeStage --plan @plan@ --stage @all
-a addStage --plan @plan@ --stage "FIRST"
-a addJob --plan @plan@ --stage @stage@ --job JOB1 \
--name "JOB1"
-a addArtifact --plan @plan@ --job @job@ \
--artifact "out.txt" \
--copyPattern "out.txt"
-a addTask --plan @plan@ --job @job@ \
--taskKey CHECKOUT \
--name "Source Code Checkout" \
--description "Checkout Default Repository"
-a addTask --plan @plan@ --job @job@ \
--taskKey SCRIPT \
--name "Script" \
--field1 "scriptLocation" \
--value1 "INLINE" \
--field2 "scriptBody" \
--value2 "echo xxx > out.txt" \
--field3 "interpreter" \
--value3 "RUN_AS_EXECUTABLE"
-a addTask --plan @plan@ --job @job@ \
--taskKey CLI_BAMBOO \
--name "Bamboo CLI" \
--field1 "scriptLocation" \
--value1 "INLINE" \
--field2 "scriptBody" \
--value2 "--help"
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.
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. We use the --continue option to keep going even if something fails along the way. The export was constructed to support updating an existing plan without deleting it first. This is important to maintain references from other plans. Also, some history is retained, but due to a Bamboo limitation, previous logs are lost. Use movePlan to another location (project or key change) in order to save all logs.