<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=299788&amp;fmt=gif">
Skip to content

Atlassian Bamboo Build Plan to Code

Bamboo is a great CI/CD tool in itself and combined with the rest of the Atlassian suite, it is even better.

Bamboo Over Jenkins

Let's review why we at Isos love Bamboo so much, and over Jenkins (and we LOVE Jenkins too):

  • Batteries Included: While Bamboo doesn't have the app eco-system Jenkins does, it has most of the features you normally spend hours installing and upgrading on default Jenkins installs.
  • Scalable: Bamboo build masters seem to be able to handle more concurrent builds than Jenkins does.
  • Light-weight branch-based build plans: Bamboo out of the box does a better job creating sub-build plans per branch than Jenkins.
  • Enterprise Permissions: Bamboo's permission model is a lot like Jira/Bitbucket, so rolling it out in an enterprise can be accomplished with more confidence.
  • Deployment is a first-class concept: The concept of deploying code or a pipeline is in Bamboo's DNA.

What's the beef with Bamboo then?  Most of our clients have this feeling that Bamboo just feels 'old school' compared to modern CI/CD platforms.

On the top of the list of Bamboo not being modern:

  • Build plans are configured via the gui
  • Build plans are not portable between Bamboo versions

Basically, you can't express build plans as code.

But wait - you can!

Almost two years ago with the release of Bamboo 6.0, Atlassian added the ability to store build plans as code. With this feature you could use both Java and yaml to express said build plans.

The deal is this: for most uses cases, yaml is a great, clean way to express your builds. yaml is used by many other CI systems and you'll feel right at home in Bamboo.

However, yaml does not have 100% feature coverage of all Bamboo features and apps. The complete alternative is Java SpecsRight now you can convert ANY build plan to a Java Spec file with almost zero thinking.

Let's do it!

Quick Steps to Java Spec Nirvana

Set up your Environment:

The tutorial on setting up a Java Spec maven project is great.

Have Bamboo convert your build plan to a Java Spec automagically.

For any build plan, you can have Bamboo convert it to a Java Spec.

Go to "Configure" plan.

Then "View plan as Java Specs".

Make edits to the plan:

The automatic conversion is good but below are they types of edits you will have to make to almost any converted plan before it will run in Bamboo.

First, you need to convert any local passwords to a build plan to a shared credential. You need to add the import of the class at the top and add the referencing within the build plan.

 

 

Next, you need to remove the oid reference to the Bamboo project otherwise it will try to recreate the project and fail.

 

 

For some plan steps, like building a Docker image from an embedded Dockerfile, you need to make the Dockerfile a proper multi-line Java string.

 

 

Finally, we recommend not embedding plan specific permissions. Having the plan inherit permissions from the container project is the most portable method.

 

 

That's It!

To convert the rest of your jobs, just rinse and repeat.

New call-to-action

See More From These Topics