I am trying to pass a value of variable in a Variable Set which is being set in one step.
Using
Set-OctopusVariable -name “OctopusDeployPath” -value “$currFolder”
In the same step or the next
The value does not seem to be being passed.
$FolderPath = $OctopusParameters[“OctopusDeployPath”]
Write-Host “— $FolderPath”
Thanks for getting in touch! The variable is being set, but it is being linked to the step.
The following blog post explains how to grab variables between steps:
Where as the article refers to Nuget Package steps and Intervention steps,
Octopus.Action[StepName].Output.Package
Octopus.Action[StepName].Output.Manual
I need it for Powershell Steps.
The Set-OctopusVariable -name “TestResult” -value “Passed”
Set-OctopusVariable -name "TestResult" -value "Passed"
You can then use it in a subsequent deployment step (in the same deployment) like this: $TestResult = $OctopusParameters["Octopus.Action[StepA].Output.TestResult"]
If the first powershell script is being run on a different machine to step 3 you need to use the reference of the machine it is created on.
Based on your below description if you change this line to $myVar = $OctopusParameters["Octopus.Action[myStepName].Output[atlasdevsql2012].myVar"]
it should work.