Skip to content

Commit 3106325

Browse files
committed
chore: download curl-ca-bundle.crt instead of roots.pem
1 parent d20232b commit 3106325

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

ci/kokoro/windows/builds/bazel.ps1

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,23 @@ function Invoke-gRPC-Quickstart {
8383

8484
if (Test-Integration-Enabled) {
8585
Write-Host "`n$(Get-Date -Format o) Running minimal quickstart prorams"
86-
86+
8787
# Install certificates and set up environment variables for BoringSSL
8888
Install-Roots-Pem
89-
90-
# BoringSSL prefers forward slashes for paths, even on Windows
91-
$RawRootsPath = Join-Path $env:KOKORO_GFILE_DIR "roots.pem"
92-
$RootsPath = $RawRootsPath -replace '\\', '/'
93-
$KeyPath = (Join-Path $env:KOKORO_GFILE_DIR "kokoro-run-key.json") -replace '\\', '/'
9489

90+
# 2. MAGIC STEP: Add directory to PATH so libcurl finds the .crt file automatically
91+
$env:PATH = "${env:KOKORO_GFILE_DIR};" + $env:PATH
92+
93+
# 3. Point gRPC to the same file. It handles .crt extensions perfectly fine.
94+
$RootsPath = (Join-Path $env:KOKORO_GFILE_DIR "curl-ca-bundle.crt") -replace '\\', '/'
9595
$env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH = $RootsPath
96-
$env:CURL_CA_BUNDLE = $RootsPath
97-
$env:SSL_CERT_FILE = $RootsPath
96+
$KeyPath = (Join-Path $env:KOKORO_GFILE_DIR "kokoro-run-key.json") -replace '\\', '/'
9897
$env:GOOGLE_APPLICATION_CREDENTIALS = $KeyPath
9998

99+
# 4. (Optional) Clear CURL_CA_BUNDLE to prove the "Magic PATH" works
100+
# If the test passes now, it means libcurl found the file in %PATH%
101+
$env:CURL_CA_BUNDLE = ""
102+
100103
Invoke-REST-Quickstart
101104
Invoke-gRPC-Quickstart
102105
}

ci/kokoro/windows/lib/integration.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,25 @@ function Test-Integration-Enabled {
2626
return $False
2727
}
2828

29+
# ci/kokoro/windows/lib/integration.ps1
30+
2931
function Install-Roots-Pem {
32+
$DestPath = "${env:KOKORO_GFILE_DIR}/curl-ca-bundle.crt"
33+
3034
Write-Host -ForegroundColor Yellow "`n$(Get-Date -Format o) " `
31-
"Downloading roots.pem [$_]"
35+
"Downloading curl-ca-bundle.crt [$_]"
36+
3237
ForEach($attempt in (1, 2, 3)) {
3338
try {
3439
(New-Object System.Net.WebClient).Downloadfile(
3540
'https://pki.google.com/roots.pem',
36-
"${env:KOKORO_GFILE_DIR}/roots.pem")
41+
$DestPath)
3742
return
3843
} catch {
3944
Write-Host -ForegroundColor Yellow "`n$(Get-Date -Format o) download error"
4045
}
4146
Start-Sleep -Seconds (60 * $attempt)
4247
}
43-
Write-Host -ForegroundColor Red "cannot download roots.pem file."
48+
Write-Host -ForegroundColor Red "cannot download curl-ca-bundle.crt file."
4449
Exit 1
4550
}

0 commit comments

Comments
 (0)