Output variable cannot be used in following step if that step is the Release of the Other Project

I cannot succeed to propagate my output variable from the step to following Steps. Issue is that all following Steps are basically Releases of some other Projects.

I have Project1 and Step1 with variable:
Set-OctopusVariable -name “AppServer1” -value "Test"

If I try to print that in following step everything works OK!
Write-Host($OctopusParameters[“Octopus.Action[DiscoverHostnames].Output.AppServer1”])

But if I want to print that in following step which is actually a Step -> Other -> Deploy a Release
I am not getting anything :frowning:

Can it be retrieved somehow in next step which is the Release? I have 10 next steps which are the releases so I would not like to repeat the logic for retrieving the Output Variable.

I read also on https://octopus.com/docs/projects/variables/output-variables
chapter Output from deploy a release steps ( Octopus.Action[Deploy Web Project].Output.Deployment[Update IP Address].IPAddress) but that is opposite direction from what I need.
I need direction from Step to Deploy a release step, but that explains just the directions from Deploy a release step to following Step.

Please if someone knows how to achieve this, I read a lot about Octopus output variables and still cannot find a way how to resolve this.

Hi veljkosbbb,

Thank you for contacting Octopus.

Could you provide me with more details about how you are trying to use this variable in “Deploy a Release” steps? Are you trying to call this variable in a pre/post deploy script?

Looking forward to hearing back from you.

Regards,
Donny

Hi Donny,

thanks for your envolvement.
So I have Project1 and in Step1 I am setting the output variables.
In Step2 I select Other - > Deploy Release (and in that select Project2) and in the first Step of that project2 I am trying to retrieve the value for output variables from the Project1 where Project2 is the child project for the Project1.
So in that following step, on the level of the Project2 step I am trying to retrieve the value by using the:
Write-Host($OctopusParameters[“Octopus.Action[DiscoverHostnames].Output.AppServer1”])

but I am not getting anything as value.
But I really need to retrieve the value within my following step - that is actually a release of some other project.

Hope it is clear now what is the issue.
Thanks

Hi veljkosbbb,

Thank you for the detailed explanation.

What you are describing is not something Octopus can do natively. However, we do have a PowerShell script available on our github that allows you to modify or add variables to a project: https://github.com/OctopusDeploy/OctopusDeploy-Api/blob/master/REST/PowerShell/Variables/ModifyOrAddVariableToProject.ps1

Hopefully the PowerShell script can help you work around this limitation in Octopus. Please let me know if you have any additional questions.

Regards,
Donny

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