Exporting existing plans to Bamboo Specs
To ease migration of your Bamboo plans to configuration as code, we have prepared the export feature. In order to export existing plan to Bamboo Specs source code:
- If you don't have Bamboo Specs project, create one.
- Go to your plan and select Actions > Configure plan.
- On the plan configuration page, select Actions > View plan as Bamboo Specs.
- Copy generated Java code to your code editor by putting it in the PlanSpec#createPlan method for instance.
The code is ready to run, with few exceptions:
- sensitive data is not exported - you will see "/* PUT YOUR SENSITIVE INFORMATION HERE*/" code comment to fill up the data
- manually created branches are not exported - you can add them manually in the UI
We advise you to cross-check the generated code with Bamboo Specs reference manual and to compare original and generated plan.
You will find equivalent classes for the vast majority of Bamboo concepts in the generated code, such as: plans, stages, jobs, tasks of different kinds, permissions, deployments. The export feature also handles tasks not known to Bamboo (e.g. third party plugins or a plugin written by you) via a generic AnyTask class.
You may want to refactor the code generated, for instance: split code into smaller methods, extract common parts or merge code from several Bamboo plans into one Bamboo Spec project.