4

I am trying to assign value to built-in release notes variable in "Run a Script" step.

$OctopusParameters["Octopus.Release.Notes"] = "Some release notes"

In the next step "Send an Email" I am using this variable in email body, but unfortunately it is empty.

<p>#{Octopus.Release.Notes}</p>

Is it possible to set Octopus Deploy system variable value from PowerShell and use it in the next step?

I am using Octopus Deploy 3.7.11.

EDIT:

I have also tried the cmdlet Set-OctopusVariable and it did not work.

Set-OctopusVariable -name "Octopus.Release.Notes" -value "Something"
1
  • How is this related to my question? I am asking how to set variable in Octopus Deploy not the environment variable in Windows. Commented Jan 12, 2017 at 7:56

2 Answers 2

6

I don't think it is possible to overwrite values of the built-in variables provided by Octopus Deploy. But you could define your own output variable and refer to that in the following steps. For example in your 'Run a script'-step use:

Set-OctopusVariable -name "MyReleaseNote" -value "Some text here"

Then the "Send an Email"-step can refer to this text by using the following (assuming the first step is called 'FirstStep'):

#{Octopus.Action[FirstStep].Output.MyReleaseNote}

The variable can also be used from a script in other steps, then use the syntax:

$relnote = $OctopusParameters["Octopus.Action[FirstStep].Output.MyReleaseNote"]

(If you want to save the generated releasenote perhaps you could save it as an 'artifact' in the project).

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, I have already done like this and it works. My initial idea was to populate built-in release notes variable so that release notes are displayed in the specific release.
0

I tried this using Octoposh. Modifying an existing variable is covered in the Octoposh wiki at Modifying Variables - Edit a variable of a Project/Library variable set.

I wasn't able to get this to work because of timeouts on our network, but it looks like it should work - just not as straight-forward as I expected.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.