Can't Pass variable value into next step within a package

I am running Octopus Deploy 2.5.8.447.

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”

Hi Reggie,

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:

Hope that helps!
Vanessa

I am sorry it does not.

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”

Does not seem to work.

Thanks for your reply!

Reggie Perez

Hi Reggie,

At the very top of the article it shows:

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"]

Hope this helps!
Vanessa

The following has been our experience. Both steps are Run a Powershell Script steps.

We can see the variables getting set in the 2nd step, but cannot get it to be saved into the new variable in the 3rd step.

  1. Step 2(Works)
    Set-OctopusVariable -name “myvar” -value “1”

Updating the running deployment’s variable set with output from ‘TestVarSet’ on atlasdevsql2012:

[…].myvar = 1

  1. Step 3(Doesn’t work)
    $myVar = $OctopusParameters[“Octopus.Action[myStepName].Output.myVar”]

myVar becomes null

Again Thanks,
Reggie

Hi Reggie,

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.

Vanessa