|
|
@@ -13,9 +13,9 @@ |
|
|
[CmdletBinding(DefaultParameterSetName = 'Deploy')] |
|
|
[CmdletBinding(DefaultParameterSetName = 'Deploy')] |
|
|
param( |
|
|
param( |
|
|
[ValidatePattern('^[A-Za-z0-9_. -]+$')] |
|
|
[ValidatePattern('^[A-Za-z0-9_. -]+$')] |
|
|
[string]$SiteName = 'PostcardMojo', |
|
|
|
|
|
|
|
|
[string]$SiteName = 'postcardmojo.com', |
|
|
[ValidatePattern('^[A-Za-z0-9_. -]+$')] |
|
|
[ValidatePattern('^[A-Za-z0-9_. -]+$')] |
|
|
[string]$AppPoolName = 'PostcardMojo', |
|
|
|
|
|
|
|
|
[string]$AppPoolName = 'postcardmojo.com', |
|
|
[string]$DeployRoot = 'C:\inetpub\postcardmojo', |
|
|
[string]$DeployRoot = 'C:\inetpub\postcardmojo', |
|
|
[string]$BindingIpAddress = '192.168.1.115', |
|
|
[string]$BindingIpAddress = '192.168.1.115', |
|
|
[ValidateRange(1, 65535)] |
|
|
[ValidateRange(1, 65535)] |
|
|
@@ -39,6 +39,7 @@ param( |
|
|
[string]$ExpectedSha256 = '', |
|
|
[string]$ExpectedSha256 = '', |
|
|
[switch]$RunMigrations, |
|
|
[switch]$RunMigrations, |
|
|
[switch]$SkipSmokeTest, |
|
|
[switch]$SkipSmokeTest, |
|
|
|
|
|
[switch]$AdoptExisting, |
|
|
[switch]$PreflightOnly, |
|
|
[switch]$PreflightOnly, |
|
|
[switch]$DryRun |
|
|
[switch]$DryRun |
|
|
) |
|
|
) |
|
|
@@ -204,14 +205,19 @@ function Get-TargetState { |
|
|
} |
|
|
} |
|
|
$physicalPath = Get-NormalizedPath $site.physicalPath |
|
|
$physicalPath = Get-NormalizedPath $site.physicalPath |
|
|
$releasesRoot = Join-Path $DeployRoot 'releases' |
|
|
$releasesRoot = Join-Path $DeployRoot 'releases' |
|
|
if (-not (Test-PathUnderRoot -Path $physicalPath -Root $releasesRoot) -or |
|
|
|
|
|
-not $physicalPath.EndsWith('\public', [StringComparison]::OrdinalIgnoreCase)) { |
|
|
|
|
|
throw "Existing target physicalPath is outside this pipeline's release public directories: $physicalPath" |
|
|
|
|
|
|
|
|
$managedPath = (Test-PathUnderRoot -Path $physicalPath -Root $releasesRoot) -and |
|
|
|
|
|
$physicalPath.EndsWith('\public', [StringComparison]::OrdinalIgnoreCase) |
|
|
|
|
|
if (-not $managedPath -and -not $AdoptExisting) { |
|
|
|
|
|
throw "Existing target physicalPath is outside this pipeline's release public directories: $physicalPath. Pass -AdoptExisting for a one-time adoption of this site." |
|
|
} |
|
|
} |
|
|
if (-not (Test-Path -LiteralPath $physicalPath -PathType Container)) { |
|
|
if (-not (Test-Path -LiteralPath $physicalPath -PathType Container)) { |
|
|
throw "Existing target physicalPath does not exist: $physicalPath" |
|
|
throw "Existing target physicalPath does not exist: $physicalPath" |
|
|
} |
|
|
} |
|
|
Assert-ReleaseLayout -ReleasePath (Split-Path -Parent $physicalPath) |
|
|
|
|
|
|
|
|
if ($managedPath) { |
|
|
|
|
|
Assert-ReleaseLayout -ReleasePath (Split-Path -Parent $physicalPath) |
|
|
|
|
|
} else { |
|
|
|
|
|
Write-Warning "Adopting existing site at unmanaged path $physicalPath; its first release will be switched in by this deployment." |
|
|
|
|
|
} |
|
|
$parentPaths = (Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location $SiteName -Filter 'system.webServer/asp' -Name 'enableParentPaths').Value |
|
|
$parentPaths = (Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Location $SiteName -Filter 'system.webServer/asp' -Name 'enableParentPaths').Value |
|
|
return [pscustomobject]@{ |
|
|
return [pscustomobject]@{ |
|
|
Exists = $true; Site = $site; PhysicalPath = $physicalPath; ParentPaths = [bool]$parentPaths |
|
|
Exists = $true; Site = $site; PhysicalPath = $physicalPath; ParentPaths = [bool]$parentPaths |
|
|
@@ -292,6 +298,7 @@ if ($env:OS -ne 'Windows_NT') { throw 'This script must run on Windows.' } |
|
|
Assert-Administrator |
|
|
Assert-Administrator |
|
|
Import-Module WebAdministration -ErrorAction Stop |
|
|
Import-Module WebAdministration -ErrorAction Stop |
|
|
Assert-DeploymentInputs |
|
|
Assert-DeploymentInputs |
|
|
|
|
|
if ($AdoptExisting -and $PSCmdlet.ParameterSetName -eq 'Rollback') { throw '-AdoptExisting is not valid during rollback.' } |
|
|
$DeployRoot = Get-NormalizedPath $DeployRoot |
|
|
$DeployRoot = Get-NormalizedPath $DeployRoot |
|
|
Assert-DeployRoot -Path $DeployRoot |
|
|
Assert-DeployRoot -Path $DeployRoot |
|
|
if (-not [string]::IsNullOrWhiteSpace($InitialWebConfigPath)) { |
|
|
if (-not [string]::IsNullOrWhiteSpace($InitialWebConfigPath)) { |
|
|
|