Artificial Intelligence

Grokking Bamboo CI/CD, for beginners

We are heavy users of Bamboo for Continuous Integration & Continuous Delivery (CI / CD).


Filed under:

We are heavy users of Bamboo for Continuous Integration & Continuous Delivery (CI / CD). It's extremely flexible, integrates well with Jira, and elastic build agents make the most of AWS EC2 (even giving you the option of spot pricing for on-demand instances).

One of the hardest parts when you're getting started is the learning curve of the UI and its jargon. For example: Builds are called plans, but deployments have projects. Jobs run in parallel, but tasks and stages run sequentially. Builds and deploy projects are linked with artifacts and triggers.

To help demystify the terms used, and clarify the way a job flows through the process, I put together this diagram:

Bamboo job flow ⧉

Tips and tricks

Here are a few other pro tips and landmines to avoid:

Shell "safe mode" and the exit status

Each task will ultimately boil down to a sequence of CLI commands. Since Bamboo will generally not know much about what the task is supposed to do, each command needs to signal it's success or failure with exit codes. Most UNIX-y commands do this automatically, but anywhere shell scripts are used they must use "safe mode". Without this, Bamboo may not detect failures along the way and could blindly plow ahead and deploy a broken build.

Final tasks

Related to the above, a failure will halt the plan. This means any test results generated will not be parsed, unless the test parser is configured as a "final task". These always run at the end of a stage, even if there were failures along the way.

Permissions

One really dangerous mis-feature is that by default, a newly created plan allows view access for everyone (even anonymous users). As of 6.3, these defaults cannot be changed. Every time you create a new plan, make sure the first thing you do is revoke these permissions.

Force Clean Build

Most build plans will have "Source Code Checkout" as the first task. Make sure that "Force Clean Build" turned on. Otherwise, you'll have builds that succeed the on the first run of the day (when you are likely to have a fresh agent), but subsequent runs will be unpredictable.

Duplicate branch plans

Every build plan has a default branch. Unfortunately this default isn't visible when creating more plan branches, which may tempt you to add the default a second time. Don't! You'll end up executing every build twice.

That's it!

If your goal can be accomplished via CLI, it can be automated in Bamboo. Although the system seems complex, it's really just shell commands under the hood!

Similar posts

Get notified on new marketing insights

Be the first to know about new B2B SaaS Marketing insights to build or refine your marketing function with the tools and knowledge of today’s industry.