Unable to access output variable set via script module

I have a script module named “My Script Module” that sets an octopus output variable by calling the following:

set_octopusvariable "TestResult" "Passed"

I have a project with a process and a step named “My Step” that calls the script module like so:

source MyScriptModule.sh

When I try to access the output variable TestResult in following simple script step I am returned nothing.

testResult=$(get_octopusvariable "Octopus.Action["My Step"].Output.TestResult")
echo $testResult

Is it not possible to set output variables via a script module?

Thanks!

Hi @jpiccola
Welcome to the Octopus forum.

On first glance I would say its the use of your double quotes which is preventing the processing of the variable in this case. Using the double quotes as below, would most likely work, all other factors being equal. Or you can leave out the single quotes for My Step altogether.

testResult=$(get_octopusvariable "Octopus.Action['My Step'].Output.TestResult")

To see more detail on output variables:

If this doesn’t work for you, we can investigate the logs for that process and dig a bit deeper to see if other issues are at play.

In case you need it here is some more detail on the single and double quotes usage:

Let us know how you go.

Kind regards,
Paraic

1 Like

@paraic.oceallaigh That was it, the quotes. Single didn’t work for me, but removing them did. Thank you!

2 Likes

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