Skip to content

Commit 0976154

Browse files
gfraiteurclaude
andcommitted
Fix two bugs in DockerBuild.ps1 template.
Bug #1: Undefined variable reference in isolation arg - Line 46: $isolationArg was referencing itself before being defined - Fix: Use "--isolation=$Isolation" instead of "$isolationArg" - Impact: Docker isolation flag was always empty on Windows Bug #2: Script path quoting causing Docker errors - Line 1305: Nested double quotes in script invocation - Fix: Use single quotes instead: "& '$scriptFullPath'" - Impact: "invalid reference format" errors when passing script paths to Docker Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1a7858a commit 0976154

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

DockerBuild.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if ($null -eq $IsWindows)
4343
$IsUnix = -not $IsWindows # Covers both Linux and macOS
4444

4545
# Docker isolation is Windows-only
46-
$isolationArg = if ($IsWindows) { "$isolationArg" } else { "" }
46+
$isolationArg = if ($IsWindows) { "--isolation=$Isolation" } else { "" }
4747

4848
# Set BuildAgentPath default based on platform
4949
if ([string]::IsNullOrEmpty($BuildAgentPath))
@@ -1302,7 +1302,7 @@ if (-not $BuildImage)
13021302
{
13031303
$scriptFullPath = Join-Path $ContainerSourceDir $Script
13041304
}
1305-
$scriptInvocation = "& `"$scriptFullPath`""
1305+
$scriptInvocation = "& '$scriptFullPath'"
13061306
$inlineScript = "${substCommandsInline}${initCall}cd '$SourceDirName'; $scriptInvocation $buildArgsString; $pwshExitCommand"
13071307

13081308
$pwshPath = if ($IsUnix) { '/usr/bin/pwsh' } else { 'C:\Program Files\PowerShell\7\pwsh.exe' }

src/PostSharp.Engineering.BuildTools/Resources/DockerBuild.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if ($null -eq $IsWindows)
4343
$IsUnix = -not $IsWindows # Covers both Linux and macOS
4444

4545
# Docker isolation is Windows-only
46-
$isolationArg = if ($IsWindows) { "$isolationArg" } else { "" }
46+
$isolationArg = if ($IsWindows) { "--isolation=$Isolation" } else { "" }
4747

4848
# Set BuildAgentPath default based on platform
4949
if ([string]::IsNullOrEmpty($BuildAgentPath))
@@ -1302,7 +1302,7 @@ if (-not $BuildImage)
13021302
{
13031303
$scriptFullPath = Join-Path $ContainerSourceDir $Script
13041304
}
1305-
$scriptInvocation = "& `"$scriptFullPath`""
1305+
$scriptInvocation = "& '$scriptFullPath'"
13061306
$inlineScript = "${substCommandsInline}${initCall}cd '$SourceDirName'; $scriptInvocation $buildArgsString; $pwshExitCommand"
13071307

13081308
$pwshPath = if ($IsUnix) { '/usr/bin/pwsh' } else { 'C:\Program Files\PowerShell\7\pwsh.exe' }

0 commit comments

Comments
 (0)