Having same Output variable set in 2 steps

Hi,

I’m looking to have an Octopus project with 2 channels (A and B). The process for both channels is the same except for the first 2 steps. These steps extract a Nuget package from the internal Octopus feed. A extracts package “Foo”, B extracts “Bar”.

I have a Post-Deployment section in Step 1 and 2 that sets an Octopus variable ‘installLocation’.

$loc = Join-Path $OctopusParameters['Octopus.Action.Package.CustomInstallationDirectory'] "tools"
Set-OctopusVariable -name "installLocation" -value $loc

I’d like to use installLocation in further steps but reading the Output Variables documentation I’d need to know the step that the value was set, e.g.:

Octopus.Action[Download Foo].Output.TerraformConfigDir OR Octopus.Action[Download Bar].Output.TerraformConfigDir.

Is there any way that I can set a universal output value that I can access, that isn’t tied to a specific step? I’d like to avoid having channel specific steps for the rest of the steps, or having logic to workout which value is not null.

Hi Donald,

Thanks for getting in touch! Not you can’t do this I’m afraid. About the best you can do is move your output variable creation into a stand alone “Find Download Folder” script step. You should be able to check Octopus.Action[Download Bar].Package.CustomInstallationDirectory and Octopus.Action[Download Bar].Package.CustomInstallationDirectory for null there then create the appropriate variable and use Octopus.Action[Find Download Folder].Output.TerraformConfigDir everywhere. A minor improvement, but at least the null checking logic is consolidated to one place.

Hope that helps!

Mark

Thanks Mark - that makes sense.

I did some reading into conditional variables but that would have got a bit cumbersome, I’ll take the extra ‘Find Download Folder’ step as it’ll make the rest of the steps clearer.

Donald