Update Octopus Variable Value

Hi
I am trying to update value of project variable in one task and trying to use the updated value in next task. What I did is:

  1. Create a TestVar and assign it 10 as defualt
  2. In one Powershell script Step I updated value to 20.
  3. In next step which is email step I try to pass this value, but it always pass default
  4. I also try to add new Powershell script step to print value it also gives me updated value.

Any better way doing this

What I did is just $TestVar=20 in PS step

Any idea

Thanks
Sunil Bindra

Hi Sunil,

Thanks for reaching out.

What you’re running into here is that once a release is created, those variable values are set for that release and any changes you make to the variable won’t be reflected until the next time you create a release and deploy it.

I think in your case where you are trying to access the variable in a later step, you will want to use Output Variables. These will allow you to set a variable in one step, and retrieve that value in a later step of the same deployment.

Please let me know if that helps or if you have any questions.

Best,
Jeremy

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