Skip to content

Commit 287a2b3

Browse files
mokagioclaude
andcommitted
Clean up diagnostic output from PS script
Remove metadata.json dump, env var presence logging, duplicate headers, and verbose runtime listing. Keep functional code only. --- Generated with the help of Claude Code, https://code.claude.com Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1aeb612 commit 287a2b3

1 file changed

Lines changed: 13 additions & 41 deletions

File tree

.buildkite/commands/build-for-windows.ps1

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -95,71 +95,43 @@ $metadata = @{
9595
} | ConvertTo-Json
9696
Set-Content -Path $metadataPath -Value $metadata
9797
Write-Host "Generated metadata.json at: $metadataPath"
98-
Write-Host "metadata.json contents:"
99-
Get-Content $metadataPath
100-
101-
# Verify Azure auth env vars are visible to child processes
102-
Write-Host "AZURE_TENANT_ID is set: $(-not [string]::IsNullOrEmpty($env:AZURE_TENANT_ID))"
103-
Write-Host "AZURE_CLIENT_ID is set: $(-not [string]::IsNullOrEmpty($env:AZURE_CLIENT_ID))"
104-
Write-Host "AZURE_CLIENT_SECRET is set: $(-not [string]::IsNullOrEmpty($env:AZURE_CLIENT_SECRET))"
10598

10699
# Export paths as env vars for forge and package-appx to consume
107100
$env:AZURE_CODE_SIGNING_DLIB = $dlibPath
108101
$env:AZURE_METADATA_JSON = $metadataPath
109102
$env:SIGNTOOL_PATH = $signtoolPath
110103

111-
# Smoke test: sign a small dummy file to verify Azure auth works before the full build
112-
Write-Host "~~~ Smoke testing Azure Trusted Signing..."
113-
$dummyExe = "$env:TEMP\signing-test.exe"
114-
Copy-Item "C:\Windows\System32\cmd.exe" $dummyExe -Force
115-
116-
$outFile = "$env:TEMP\signtool-out.txt"
117-
118104
# The DLib is a .NET assembly (C++/CLI via Ijwhost.dll) that requires the .NET runtime.
119105
# Check if .NET 6+ is available; install if missing.
120106
Write-Host "~~~ Checking .NET runtime..."
121107
$dotnetRuntimes = $null
122-
try {
123-
$dotnetRuntimes = & dotnet --list-runtimes 2>&1
124-
Write-Host "Installed .NET runtimes:"
125-
$dotnetRuntimes | ForEach-Object { Write-Host " $_" }
126-
} catch {
127-
Write-Host "dotnet CLI not found"
128-
}
129-
130-
$hasNet6Plus = $false
131-
if ($dotnetRuntimes) {
132-
$hasNet6Plus = $dotnetRuntimes | Where-Object { $_ -match "Microsoft\.NETCore\.App\s+([6-9]|[1-9]\d+)\." } | Select-Object -First 1
133-
}
108+
try { $dotnetRuntimes = & dotnet --list-runtimes 2>&1 } catch {}
134109

110+
$hasNet6Plus = $dotnetRuntimes | Where-Object { $_ -match "Microsoft\.NETCore\.App\s+([6-9]|[1-9]\d+)\." } | Select-Object -First 1
135111
if (-not $hasNet6Plus) {
136-
Write-Host "No .NET 6+ runtime found. Installing .NET 8 Runtime..."
137-
$dotnetInstallerUrl = "https://dot.net/v1/dotnet-install.ps1"
112+
Write-Host "Installing .NET 8 Runtime..."
138113
$dotnetInstallScript = "$env:TEMP\dotnet-install.ps1"
139-
Invoke-WebRequest -Uri $dotnetInstallerUrl -OutFile $dotnetInstallScript
114+
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile $dotnetInstallScript
140115
& $dotnetInstallScript -Runtime dotnet -Channel 8.0 -InstallDir "$env:ProgramFiles\dotnet"
141-
# Refresh PATH so Ijwhost.dll can find hostfxr.dll
142116
$env:PATH = "$env:ProgramFiles\dotnet;$env:PATH"
143-
Write-Host "Verifying .NET 8 installation..."
144-
& dotnet --list-runtimes
145117
}
146118

147-
# Try signing with Azure Trusted Signing
148-
Write-Host "--- Signing with Azure Trusted Signing ---"
149-
$signtoolCmd = "`"$signtoolPath`" sign /v /debug /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 /dlib `"$dlibPath`" /dmdf `"$metadataPath`" `"$dummyExe`""
150-
Write-Host "Command: $signtoolCmd"
151-
cmd /c "$signtoolCmd > `"$outFile`" 2>&1"
119+
# Smoke test: sign a dummy file to verify Azure auth before the full build
120+
Write-Host "~~~ Smoke testing Azure Trusted Signing..."
121+
$dummyExe = "$env:TEMP\signing-test.exe"
122+
Copy-Item "C:\Windows\System32\cmd.exe" $dummyExe -Force
123+
124+
$outFile = "$env:TEMP\signtool-out.txt"
125+
cmd /c "`"$signtoolPath`" sign /v /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 /dlib `"$dlibPath`" /dmdf `"$metadataPath`" `"$dummyExe`" > `"$outFile`" 2>&1"
152126
$signtoolExitCode = $LastExitCode
153-
Write-Host "--- signtool output ---"
154127
Get-Content $outFile
155-
Write-Host "--- signtool exit code: $signtoolExitCode ---"
156128
Remove-Item $outFile -ErrorAction SilentlyContinue
157129

158130
If ($signtoolExitCode -ne 0) {
159-
Write-Host "Error: Azure Trusted Signing smoke test failed!" -ForegroundColor Red
131+
Write-Host "Error: Smoke test failed (exit code $signtoolExitCode)" -ForegroundColor Red
160132
Exit 1
161133
}
162-
Write-Host "Smoke test passed - Azure Trusted Signing is working."
134+
Write-Host "Smoke test passed."
163135
Remove-Item $dummyExe -Force
164136

165137
Write-Host "--- :npm: Installing Node dependencies"

0 commit comments

Comments
 (0)