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

Derek Rosenzweig August 18, 2016

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

3 votes
Sergey Podobry _Stellarity Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2016

Hi Derek,

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

Derek Rosenzweig August 18, 2016

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.

Krystian Brazulewicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 5, 2016

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.

Like Andrey Kukoverov likes this
1 vote
Mark de Bont
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2016

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?

Derek Rosenzweig August 18, 2016

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.

0 votes
Jason Edonick August 18, 2016
  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. 
Derek Rosenzweig August 18, 2016

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

Derek Rosenzweig August 18, 2016

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
TAGS
AUG Leaders

Atlassian Community Events