Lock build agent for duration of all stages in a configuration

Hi,

we are currently running our build in 7 distinct Continua stages. Later stages depend on binary files created in the earlier ones.
Since copying these binary files between different build agents would take a very long time we force all stages to run on the same agent by setting a variable with the agent’s name in the first stage and adding an Agent Requirement for the subsequent stages.
While this approach works it is slightly inconvenient so I was wondering if Continua already offers a similar functionality that we just missed.

Another issue we are facing with this approach is that sometimes two builds will try to run on the same agent. Since each agent can only execute one concurrent stage (a technical limitation of our build process) these two builds will swap back and forth on the agent.
Would it be possible to keep a second build from starting on an agent while another one is already running? I tried doing this with Shared Resources but I could not find a way to lock one dependant on which agent the build was started on. Also it looks like they can only be locked for single stages.

Would appreciate some feedback.

Regards,
Christoph

Hi Christoph,

The method that you have used for forcing all stages to run on the same agent is the best solution at the moment. We do plan to add an option to simplify this in the future.

One simple way you can achieve your second objective at the moment is to set the Concurrent Stages limit (on the Administration -> Agents page) to 1 for each agent. This should prevent multiple builds stages running on the same agent. Along with your current agent requirements, this should provide a solution for your scenario. It will however also apply to all other build configurations - which may or may not be an issue for you?

As you know, the agent shared resource lock is only acquired for the duration of a single stage. You can however set every stage to acquire the same agent shared resource. If your agent requirements also define that each stage must run one same agent as the first stage, then the shared resources will only be acquired from that single agent. 

To do this, set up a shared resource of type “single” on one agent (on the Administration -> Agents page) and allocate this same shared resource to the other agents. Select this resource in the Shared Resources tab in the Stage Options for each stage. This will ensure that only one stage from this build configuration will run on the required agent at a time

Note that locks on a server shared resources can be acquired for the duration of the build, however there is currently no way to link these to an agent in the agent requirements. We are however looking into options to allow shared resource labels to be referenced in expressions. 

It may also be worth looking into storing your binary files on a share accessible by all agents. If you use $Build.Id$ in the folder name then this will ensure that it is only accessed by stages in the same build. This would avoid the requirement to run all stages on the same agent. You would still need to acquire an agent shared resource lock in each stage to prevent each more than one stage running on any agent.

"One simple way you can achieve your second objective at the moment is to set the Concurrent Stages limit (on the Administration -> Agents page) to 1 for each agent."

Sorry. I wasn't quite clear on this point. This is already what we do.

Our issue is that two builds can be assigned to the same agent because an already running build is currently between two stages.
Instead of one build finishing all stages first the agent will execute one stage of build 1 and then one stage of build 2 and then keep alternating between the two builds.