Directory structure in Bamboo builds

I'm porting across a PHP project from Jenkins to Bamboo, and feel as though there's something I must be missing with Bamboo.

I wanted to get rid of the linear set of commands that we had with Jenkins and separate things out into Stages. The very first Task is to checkout the source repos, which end up in xml-data/build-dir/PROJ-PLAN-JOB1/(foo|bar|baz). Now for every task in subsequent stages, e.g. running unit tests, I need to set the working directory to "${bamboo.build.working.directory}/../PROJ-PLAN-JOB1/foo". Is this the correct way of doing things?

Also, is there a standardized location for things like configuration files? We have a set of .yml and .xml files that contain sensitive info like the live database credentials, which we don't want to keep under source control. At the moment I'm just doing the following in a script, which seems suboptimal:

cp /path/to/live-parameters.yml ${bamboo.build.working.directory}/../PROJ-PLAN-JOB1/foo/app/config/parameters.yml

TL;DR I want to work on the same set of files in each Stage of my Plan, but it appears that I always need to refer to the relative path of the subdirectory where the files are first checked out. Is this correct?

2 answers

1 accepted

2 votes

Let me explain why it is so.

The stages are designed with parallel & distributed execution in mind. You can define many jobs in single stage and they will run in parallel (as long as you provide enough agents). But this has consequence on how we had to organise working directories: since jobs can run in parallel and are dynamically assigned to agents (which can be remote), each job runs in separate directory. This in turn means that if you need to pass information to later stages you should use Artifacts.

Long story short: if your build is sequence of things to be happening on single dir, using single Job is better solution.

What you do will work only as long you don't use concurrent builds and have only 1 agent that runs your build.

I see, thanks for the quick response!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,324 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you