Exclude a step if running from my tenant

Hello,

I have a project which has a step that I don’t want to run from my tenant. I need the step to run for normal non-tenant deployments.

I tried setting up a dummy tenant tag and filtering the step with that, but then it’s not available for non-tenant deployments either :frowning: .

I can probably come up with some way to rewrite the step so it does nothing if running from the tenant. But before I go down that path I’m wondering if I’ve missed something. Is there a way to tell the step not to run if deploying to a tenant?

Hey there Andrew,

Making sure I understand - you have a deployment process that covers both tenanted and untenanted deployments, and you have a step that you only want to run on the untenanted deployments?

You were on the right track, but the tenant tagging allows for the inverse, where it will only run for the tenanted deployments. There’s a way to get the behavior you’re looking for by using a system variable combined with a variable run condition on your step:

The text for the run condition is #{if Octopus.Deployment.Tenant.Name}False#{else}True#{/if}. When deploying, Octopus will check for a value on the system variable Octopus.Deployment.Tenant.Name, then only execute the step if there’s no tenant name present. I tested this locally with both tenanted and untenanted deployments, and the step was skipped for the tenanted deployments as expected.

Hopefully that helps get you moving in the right direction, feel free to reach out with any issues or additional questions!

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