It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Bamboo

Unable to add or edit Bitbucket Cloud repository in Bamboo

On 31 May, a GDPR-related change went live in the Bitbucket Cloud API that resulted in users not being able to create or edit Bitbucket Cloud Linked repositories in Bamboo. This API update removed t...

307 views 2 6
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you