Run Stage on all relevant agents

We now are using Continua to do our releases, having previously just used it to do the build and deploy to the test environment.

We have two UAT and two Production servers, so we will install the agent onto each of these 4 servers.

The release script calls a Powershell script that makes a zipped archive of the current server artifacts.

How do we get Continua to run this script on all 4 agents, rather than just the first available, and to pause execution until the stage has completed ?

I can see a “workaround” but not sure if this is very scalable.
If I create a stage and add the stage requirement to be an agent property that is different for each of the 4 servers, and then clone that stage to get 4 stages where each has a stage requirement corresponding to one of the four server agent properties then it would run through each of those 4 stages.

A bit messy and a pain if we add new servers.

I’m still after a better way of getting this to work

Hi David,

The “workaround” solution that you propose is one that we use on our own build server to update tools on our agents. This works fine, but as you say, it does require some additional configuration when a new agent is added (or removed). Installing a new agent generally requires plenty of configuration tasks anyway.

We don’t currently have a way to run one stage on more than one agent, although this is something that we would like to implement in the future. Unfortunately, it’s not a quick feature that we can put together in the short term.

Another solution would be to start the script from a single agent and use Powershell remoting to execute it on each server. This involves sending the -ComputerName and also credentials as parameters to the PowerShell action - see Using saved credentials securely in PowerShell scripts. The PowerShell actions in Continua CI and FinalBuilder do currently allow you to specify any parameters so this should be achievable without any updates. We do however plan to update the actions with new fields to make it easier to specify the parameters required for remoting.

The PowerShell action could be iterated for each server using the For Each action in Continua CI.

Alternatively, you could make use of our Octopus Deploy build event handler to start an Octopus Deploy deployment to run the Powershell scripts at the end of a stage or the build.

I type an entire description of a simpler solution but it disappeared on Reply…
If you are interested in details let me know, I will write it again.

The idea is for the build to trigger itself and store agent hostnames to build variable, then agent requirements base on that variable and skip already processed agents.
I tested it and it works.

It has one caveat tho, meaning end condition in pure Continua may not work properly as Continua has no list variables and operators.

1 Like

That’s a great idea Michal.

A Build Completed trigger can be used to recursively trigger the same build. Continua CI does have some list functionality which, although limited, can be used to achieve this.

  • First set up a Text variable “AgentList” containing a list of the agent host names. e.g. "agent1","agent2","agent3". You can use a Checkbox Select prompt type here if you want to allow users to select which agents to run on.

  • Then create a Numeric variable “AgentIndex” initialised to “0”.

  • Add a Build Completed Trigger.

    • Set the Configuration to the point to the current configuration.
    • Under Variables, select AgentIndex and set the value to $Utils.GetNumber(%AgentIndex%).Add(1)$.
    • Under Conditions, add the expression [%AgentIndex%] [Less than] [$Utils.GetString(%AgentList%).Split(",").Count.Subtract(1)$]
  • In your stage Agent Requirements, add the expression [$Agent.Hostname$] [Equals] [$Utils.GetString(%AgentList%).SplitWithQuotes(",","double",true).Item(%AgentIndex%)$]

Didn’t know about that :slight_smile:
This fixes the caveat.

Is there any documentation for those functions ?
What does “double” stand for ?

Yes: String Object - Continua CI - VSoft Technologies Documentation Wiki (

Double quotes

Just circling back onto this issue as it is biting us as we move to more servers. I stumbled onto this blog post from 7 years ago …

So I think we need to use the right tool for the job, and use Continua to do the build, and orchestrate the deployment through our various environments with something like Octopus.

Continua can call Octo jobs, so that is a good place to start from

Does this support applications compiled from Delphi code ?

Hi David,

Yes, you can deploy Delphi applications using the Octopus Deploy integration in Continua CI. The executable files can be packaged as a zip file which can then be extracted and deployed using various steps in the Octopus Deploy process.

In your Continua CI build configuration, after the normal build actions, you’ll need to create a Zip package containing all the build output files that you wish to deploy. You can use the Octo Pack Action for this.

Next you’ll need to push the package to the built-in repository on your Octopus Deploy server. You can use the Octo Push Action for this.

On your Octopus Deploy server, create a deployment project. This will need to contain all the steps required to extract the files from the zip package, copy them to the required locations and configure the application.

Then, go back to your Continua CI configuration, and add an Octopus Deploy build event handler. This can be used to create a deployment on the Octopus Deploy server for a specific project (usually at the start of the build) and then run the deployment release at the end of the build (once the package has been uploaded).

The blog post you referred to is old, as you say, but still very much applicable to deploying .Net applications built using MSBuild. We plan to write a new blog post describing the process for deploying a Delphi application in more detail in due course.