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.