Custom deployment script powershell variable evaluating incorrectly

(josh.williams) #1

We have a package deploy step, that contains a windows service utilizing https://github.com/PeterKottas/DotNetCore.WindowsService

His Service doesn’t jive too well with Octopus, but we’ve traditionally been able to just use custom deployment scripts. But now the Octopus.Environment.Name substitution is not working.

Here is the deployment script portion
./LENSSX.StateHost.exe display-name:State_Host_$OctopusParameters[“Octopus.Environment.Name”] name:State_Host_$OctopusParameters[“Octopus.Environment.Name”] action:install

This names and installs the service. But $OctopusParamters[“Octopus.Environment.Name”] is evaluating to this:

Successfully registered and started service “LENSS_State_Host_System.Collections.Generic.Dictionary`2[System.String,System.String][Octopus.Environment.Name]” (“This application that is responsible for communicating with the state hosted databases”)

Any ideas why this may be?

WIndows Server version 2008 R2 Datacenter. Octopus 4.

(josh.williams) #2

The solution was to wrap the param in $() …
$($OctopusParameters[“Octopus.Environment.Name”])

(Matt Richardson) #4

Hi Josh

Glad to see you’ve got it resolved - PowerShell string interpolation can be a pain sometimes.

Happy deployments!

Cheers,
Matt

(system) closed #5

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