Dynamic Output Variable

I have a variable that utilizes Octopus.Action (i.e. #{Octopus.Action[Get My Other IP].Output.OtherIP} )

Is it possible to do the following:

The step would run on the machine tagged “other” but there’s potential for it to be offline / not registered. If it’s not registered, I’d like the variable to fall back to “localhost”.

I was thinking maybe I had to do it in two steps? (step #1 to try to get the IP and step #2 to set the output variable based on the outcome of step #1). Is the deployment going to be unhappy if the machine that runs #1 is offline / no machine with the tag is found?

Thanks.

Hi,

Thanks for getting in touch. I think you are on the right track. It sounds like you want the machine in step 1 to report its IP address and use that in your deployment or fall back to “localhost”?

I think if you run that first step on a machine and set the output variable and then in the second step check if the variable exists and if it doesn’t use “localhost” you will get the outcome you are after.

Octopus will fail the deployment if the machine that is supposed to run step 1 is registered but offline. If there is no machine registered with a matching role in your environment then Octopus will just skip that step.

Hope this helps.

Cheers,
Shane

Sounds good. Just to confirm - I can attempt to grab an output variable from a step that was not ran and it will just give me $null back right?

Hi Jamie,

Yes, if the variable does not exist it will -eq $null.

Cheers,
Shane