How can I ensure all jobs in a build are run on the same agent?

Hello,

I have set up a Bamboo build plan that requires all jobs/stages to be run on the same physical machine (IE they depend on each other). When they are not, the builds fail. Is there any way to specify on a build-level that the jobs must run on the same physical machine? We use ELASTIC agents here, so we can't assume the hostname. I understand the Agent Matrix and Capabilities and all that, but this problem is not solved by specifying a capability since multiple instances of the ELASTIC agent will all have the same ones. Thanks!

3 answers

Hi Derek,

Use tasks instead of jobs. They will be executed sequentially on the same agent. 

I'm aware of how stages/jobs/tasks work, and I did consider refactoring everything into a single job, but there are fairly distinct stages. (A. lint the code and create a build artifact, B. run Chef provisioning to create a webserver, C. run the tests). C is dependent on B which is dependent on A.

The whole point of using Stages is ability to parallelize Job execution. By putting it all on the same agent you're serializing the whole flow so what's the point of creating stages? I think that Sergey's answer solves your problem.

Defining a custom key/label for each agent (like: Hostname with the corresponding hostname) and then ensure the job has the requirement to run on a specific hostname?

The problem with this method is that we use ELASTIC agents - they spin up/down as needed and thus hostnames will never be the same at all times.

  1. Go to the agent you wish to pin the builds to
  2. Add a custom capability similar to this: 
    image2016-8-18 10:49:13.png
  3. Then, go to your build plan and add this to the requirements tab
    image2016-8-18 10:50:19.png
  4. You should be all set. 

I don't see a Requirements tab on my build plan.

I see one on each job, and I already have some required capabilities defined. The problem with this method is that we use ELASTIC agents - they spin up/down as needed. 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
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,567 views 0 6
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