Execution Location confusion

We have a project with 1 untenanted location and 5 tenanted locations, per environment. I have a powershell script that needs to execute once, on the Octopus Server, per release deployment. E.g. if I deploy to “Live”, Octopus Server executes this script once.

In my step, there’s three options:

Run on the Octopus Server
The helpful image says “Execute once on the Octopus Server”. This sounds like exactly what I want.

Run on the Octopus Server on behalf of each deployment target
The helpful image says “Execute on the Octopus Server on behalf of all the deployment targets in selected roles”. Okay, this sounds like it will run once, per individual infrastructure target. This sounds like what I would want if I was only deploying to one machine for all 6 deployments of an environment.

Run on each deployment target (default)
The helpful image says “Execute on each deployment target with the selected roles”. This is what normally happens, each individual deployment would run the script (not the Octopus Server)

I thought the first option is what I would want. Instead, I’ve found my script is being run 6 times on the Octopus Server. I know this because I look at the Task log, and for each tenant, and the one untenanted installation, the script is run on the Octopus Server, and are conflicting. I don’t understand why the script is not being run exactly once on the Octopus Server, per deployment, regardless of the number of deployment locations.

Hi Sam,

Thanks for getting in touch.

The execution location only determines on what deployment target (Tentacles, SSH connections etc) the step will run on, Tenants is a way to allow you to deploy your projects into multiple isolated containers on the deployment targets inside your environments.

As per our docs there is no way to have a single step run only once when doing multi-tenanted deployments.

I hope that helps in clarifying what the Execution location setting does, and I’m sorry for any inconvenience caused.

Thank you and best regards,

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.