Reading output variables in step templates

Hello,

I am trying to write a step-template that will depoy a package and install a windows service, and configure the service description using content from within the package being deployed.

What I would like to do, is run a PS deploy script (within the same step) that will read a file with description information, then output to a variable via the “Set-OctopusVariable” commandlet. Then in the windows service description field I need to bind to the output variable that was set in the deploy script. Because its in a step-template I cannot simply reference the output variable with a specific action name. So I have tried this:

#{Octopus.Action[#{Octopus.Action.Name}].Assembly.Product.Info}

But Octopus Deploy doesnt seem to support this nested variable syntax.

Any suggestions to solving my problem would be very helpful.

Thanks in advance!

Hi There,

Thanks for reaching out! I’m afraid its not possible to do that using Set-OctopusVariable because the output variables created that way are only available after that step ended.

You could add a post-deployment script that fetches this info for you and then modifies the Service description. Something like this:

$ServiceName = "" #name of the service
$Description = #Put logic to read your file here

Set-Service -name $ServiceName -description $description #No need to stop or start the service for this

Hope that helps,
Dalmiro

Thank you for your suggestion! This is the route I will go.