Programmatically set the Target Role at the start of a deployment

The “On Behalf Of” section of my Helm Chart Update step lets me set a tag that essentially decides where to deploy the release. The majority of the time this is static.

But sometimes I want to redirect the deployment to my Sandbox cluster. My Sandbox cluster is setup the same as my real cluster. It has the same environments setup and such. It would be nice to be able to do this without having to modify the actual deployment step to have a different Target Role.

I do not want to have to duplicate my environments to have a SandboxDev, SandboxStage, SandboxTest, SandboxProd. (I would rather modify the “Process” each time I need to test on sandbox.)

Is there some way I can use a the Helm Chart’s pre-deployment script to have the target role change?

Greetings OctopusSchaff, thanks for reaching out! Have you looked into the multi-tenant deployment pattern? Using the multi-tenant feature, you could have your regular process be untenanted or a tenant with your sandbox being a tenant. This would allow the tenants to share the same environments and deployment process. When deploying a release, you could deploy to the sandbox tenant without having to change anything in your deployment process. Does this help?



Thank you for the response. Unfortunately I am already using tenants for Blue / Green deployments. (And I use them when I test in Sandbox.)

Similar to the environments, I don’t want to clutter up the list of tenants with SandboxBlue and SandboxGreen. (That will just confuse my Ops team.)

If not that could have worked well.

I am guessing from your response that there is no way to programmatically set that value at the start of a deployment? If there is not, then that is fine. This is not a “Must Have” feature for me. It would have been convenient to be able to easily switch between Sandbox deployments and the real thing, but I can just manually change the process when I need to test.

Unfortunately no, roles cannot be changed at deploy time as they are baked into the snapshot of the release itself.