PowerShell failed due to project variable duplicating an internal octopus one

We recently changed one our legacy applications to deploy via Octopus Deploy. In the process of doing so, we migrated all the existing configuration variables that were configured through custom means to the variable management provided by Octopus Deploy.

That was until we saw the following exception. It appears that the variable we defined (named “host”) overlaps with one that is used in the bootstrap script used by Octopus Deploy. Could you guys provide more insight into which variables names we cannot use? Or could you change the design such that it makes it more difficult for this scenario to occur?

2013-12-05 17:32:04 DEBUG Finding CI machines in the following role(s): intranet

2013-12-05 17:32:04 DEBUG Found machines:

2013-12-05 17:32:04 DEBUG - Buildserver (http://buildserver:10933/)

2013-12-05 17:32:04 INFO Execute step Test PowerShell

2013-12-05 17:32:06 INFO Step completed

Execute step Test PowerShell against machine Buildserver

2013-12-05 17:32:04 INFO Begin script run

2013-12-05 17:32:04 DEBUG Running script against tentacle http://buildserver:10933/

2013-12-05 17:32:06 INFO Job successful. Tentacle output follows:

2013-12-05 17:32:05 INFO ERROR: Cannot overwrite variable Host because it is read-only or constant.

2013-12-05 17:32:05 INFO ERROR: At C:\Users\OctopusDeploy\AppData\Local\Tentacle\Temp\Bootstrap.761c5790-487a-4af9-83fd-66334e9d1c05.ps1:57 char:1

2013-12-05 17:32:05 INFO ERROR: + $Host = [System.Text.Encoding]::UTF8.GetString( [Convert]::FromBase64String( "V2 …

2013-12-05 17:32:05 INFO ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2013-12-05 17:32:05 INFO ERROR: + CategoryInfo : WriteError: (Host:String) [], SessionStateUnauthorizedAccessException

2013-12-05 17:32:05 INFO ERROR: + FullyQualifiedErrorId : VariableNotWritable

2013-12-05 17:32:05 INFO ERROR:

2013-12-05 17:32:05 INFO Test

2013-12-05 17:32:05 INFO ==============================================

2013-12-05 17:32:05 INFO PowerShell exit code: 0

2013-12-05 17:32:05 INFO ==============================================

Hi Mike,

All predefined Octopus variables begin with “Octopus”. “Host” is actually a
PowerShell variable:

http://mshforfun.blogspot.com.au/2006/08/do-you-know-there-is-host-variable.html

There is a list of all predefined PowerShell variables here:

http://technet.microsoft.com/en-us/library/hh847768.aspx

Hope that helps,

Regards,

Paul Stovell
Octopus Deploy
W: octopusdeploy.com | T: @octopusdeploy http://twitter.com/octopusdeploy