I am trying to set the OctopusWebSiteName variable in my PreDeploy.ps1 script with no success,
My PreDeploy.ps1 script is as follows:
if ($OctopusPackageVersion -match "^[0-9]+[.][0-9]+[.][0-9]+-(.*)-[0-9]+$") {
$applicationName = $matches[1]
} else {
$applicationName = $OctopusPackageName
}
Set-OctopusVariable -Name "OctopusWebSiteName" -Value $applicationName
Write-Host "OctopusWebSiteName set to" $applicationName
The relevant parts of my build logs are as follows
Execute step Deploy Web application against machine *** Edited ***
2013-11-07 08:29:04 INFO Begin deployment
2013-11-07 08:29:04 DEBUG Deploying package IPE.Web 1.1.50-master-116 to tentacle http://10.20.24.31:10933/
2013-11-07 08:29:35 INFO Job successful. Tentacle output follows:
2013-11-07 08:29:44 DEBUG Begin deployment of package: IPE.Web.1.1.50-master-116
2013-11-07 08:29:44 DEBUG Package file path: C:\Octopus\Applications\.Tentacle\Packages\IPE.Web.1.1.50-master-116_FDFEC625450C82428075AC71119936C3.nupkg
2013-11-07 08:29:44 DEBUG Package file hash: ea1b6a22d0045ba24b90b41f3df1880c512ded6b
2013-11-07 08:29:44 DEBUG Tentacle Agent information:
2013-11-07 08:29:44 DEBUG - Machine name: *** Edited ***
2013-11-07 08:29:44 DEBUG - Is 64-bit: True
2013-11-07 08:29:44 DEBUG - Service user name: SYSTEM
2013-11-07 08:29:44 DEBUG - CLR version: 4.0.30319.1008
2013-11-07 08:29:44 DEBUG - Current directory: C:\Windows\system32
2013-11-07 08:29:44 DEBUG - OS version: Microsoft Windows NT 6.1.7601 Service Pack 1
2013-11-07 08:29:44 DEBUG - Tentacle version: 1.6.3.1723
2013-11-07 08:29:44 DEBUG Package will be extracted to: C:\Octopus\Applications\UPP-CI
2013-11-07 08:30:08 DEBUG The following variables are available:
.
.
.
2013-11-07 08:30:08 DEBUG - [OctopusPackageVersion] = '1.1.50-master-116'
2013-11-07 08:30:08 DEBUG - [OctopusPrintVariables] = 'true'
2013-11-07 08:30:08 DEBUG - [OctopusProjectId] = 'projects-97'
2013-11-07 08:30:08 DEBUG - [OctopusProjectName] = 'UPP'
2013-11-07 08:30:08 DEBUG - [OctopusProjectWebLink] = '/projects/upp'
2013-11-07 08:30:08 DEBUG - [OctopusPurgePackageDirectoryBeforeCopy] = 'False'
2013-11-07 08:30:08 DEBUG - [OctopusReleaseNumber] = '1.1.50-master-116'
2013-11-07 08:30:08 DEBUG - [OctopusReleaseWebLink] = '/projects/upp/releases/1.1.50-master-116'
2013-11-07 08:30:08 DEBUG - [OctopusRetentionPolicyDaysToKeep] = '7'
2013-11-07 08:30:08 DEBUG - [OctopusRetentionPolicySet] = 'DeploymentEnvironments-257/projects-97/Step-feeds-97/IPE.Web/machines-98'
2013-11-07 08:30:08 DEBUG - [OctopusTaskId] = 'tasks-95233'
2013-11-07 08:30:08 DEBUG - [OctopusWebSiteName] = ''
2013-11-07 08:30:08 DEBUG - [ServerUrl] =' *** EDITED ****'
2013-11-07 08:30:08 DEBUG - [SiteURLMappings] = '#{ServerUrl}/#{OctopusWebSiteName},#{ServerUrl}/#{OctopusWebSiteName}'
2013-11-07 08:30:08 DEBUG [PreDeploy Script] Script: C:\Octopus\Applications\UPP-CI\IPE.Web\1.1.50-master-116\tools\PreDeploy.ps1
2013-11-07 08:30:08 INFO [PreDeploy Script] OctopusWebSiteName set to master
2013-11-07 08:30:09 INFO [XML Transformation] Looking for any configuration transformation files
2013-11-07 08:30:09 DEBUG [XML Transformation] Start tranformation to 'C:\Octopus\Applications\UPP-CI\IPE.Web\1.1.50-master-116\content\Web.config'.
2013-11-07 08:30:09 DEBUG [XML Transformation] Source file: 'C:\Octopus\Applications\UPP-CI\IPE.Web\1.1.50-master-116\content\Web.config'.
2013-11-07 08:30:09 DEBUG [XML Transformation] Transform file: 'C:\Octopus\Applications\UPP-CI\IPE.Web\1.1.50-master-116\content\Web.UPP-CI.config'.
2013-11-07 08:30:09 DEBUG [XML Transformation] Executing SetAttributes (transform line 8, 7)
.
.
.
2013-11-07 08:30:09 INFO [XML Configuration] Looking for appSettings and connectionStrings in any .config files
2013-11-07 08:30:09 DEBUG [XML Configuration] Scanning configuration file: C:\Octopus\Applications\UPP-CI\IPE.Web\1.1.50-master-116\content\packages.config
2013-11-07 08:30:09 DEBUG [XML Configuration] Scanning configuration file: C:\Octopus\Applications\UPP-CI\IPE.Web\1.1.50-master-116\content\Web.config
2013-11-07 08:30:09 DEBUG [XML Configuration] Setting //*[local-name()='appSettings']/*[local-name()='add'][@key='SiteURLMappings'] to 'http://** EDITED ****/,http://** EDITED ****/'
As you can see the Write-Host in my script shows that the $applicationName value passed to Set-OctopusVariable is set to “.master” however when we get to the web transform the value of OctopusWebSiteName in the SiteURLMappings variable is “”.
I am at a loss as to how I can debug this further. There doesn’t appear to be any DEBUG information when a variable is set.
PS: I have replaced sensitive information with *** Edited *** and removed some lines from the output.