Skip to content

Commit 93b062f

Browse files
committed
fix: quickstart env variables
1 parent eb0d822 commit 93b062f

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

ci/kokoro/windows/builds/bazel.ps1

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,59 @@ if ($LastExitCode) {
6262
. ci/kokoro/windows/lib/integration.ps1
6363

6464
function Invoke-REST-Quickstart {
65-
bazelisk $common_flags run $build_flags `
66-
//google/cloud/storage/quickstart:quickstart -- `
67-
"${env:GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME}"
68-
if ($LastExitCode) {
69-
Write-Host -ForegroundColor Red "bazel run (storage/quickstart) failed with exit code ${LastExitCode}."
70-
Exit ${LastExitCode}
65+
try {
66+
$executable = "bazel-bin/google/cloud/storage/quickstart/quickstart.exe"
67+
Write-Host "Running REST Quickstart, executable found at: $executable"
68+
# bazel-bin is a symlink, and PowerShell does not automatically resolve it
69+
# when running executables.
70+
$resolved_executable = Resolve-Path $executable
71+
Write-Host "Resolved executable path: $resolved_executable"
72+
& $resolved_executable "${env:GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME}"
73+
if ($LastExitCode) {
74+
Write-Host -ForegroundColor Red "bazel run (storage/quickstart) failed with exit code ${LastExitCode}."
75+
Exit ${LastExitCode}
76+
}
77+
} catch {
78+
Write-Host -ForegroundColor Red "Caught exception while trying to run storage/quickstart: $_"
79+
Exit 1
7180
}
7281
}
7382

7483
function Invoke-gRPC-Quickstart {
75-
bazelisk $common_flags run $build_flags `
76-
//google/cloud/pubsub/quickstart:quickstart -- `
77-
"${env:GOOGLE_CLOUD_PROJECT}" "${env:GOOGLE_CLOUD_CPP_PUBSUB_TEST_QUICKSTART_TOPIC}"
78-
if ($LastExitCode) {
79-
Write-Host -ForegroundColor Red "bazel run (pubsub/quickstart) failed with exit code ${LastExitCode}."
80-
Exit ${LastExitCode}
84+
try {
85+
$executable = "bazel-bin/google/cloud/pubsub/quickstart/quickstart.exe"
86+
Write-Host "Running gRPC Quickstart, executable found at: $executable"
87+
# bazel-bin is a symlink, and PowerShell does not automatically resolve it
88+
# when running executables.
89+
$resolved_executable = Resolve-Path $executable
90+
Write-Host "Resolved executable path: $resolved_executable"
91+
& $resolved_executable "${env:GOOGLE_CLOUD_PROJECT}" "${env:GOOGLE_CLOUD_CPP_PUBSUB_TEST_QUICKSTART_TOPIC}"
92+
if ($LastExitCode) {
93+
Write-Host -ForegroundColor Red "bazel run (pubsub/quickstart) failed with exit code ${LastExitCode}."
94+
Exit ${LastExitCode}
95+
}
96+
} catch {
97+
Write-Host -ForegroundColor Red "Caught exception while trying to run pubsub/quickstart: $_"
98+
Exit 1
8199
}
82100
}
83101

84102
if (Test-Integration-Enabled) {
85103
Write-Host "`n$(Get-Date -Format o) Running minimal quickstart prorams"
86104
Install-Roots-Pem
87-
${env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH}="${env:KOKORO_GFILE_DIR}/roots.pem"
88-
${env:GOOGLE_APPLICATION_CREDENTIALS}="${env:KOKORO_GFILE_DIR}/kokoro-run-key.json"
105+
$env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH = "$env:KOKORO_GFILE_DIR/roots.pem"
106+
$env:CURL_CA_BUNDLE = "$env:KOKORO_GFILE_DIR/roots.pem"
107+
$env:GOOGLE_APPLICATION_CREDENTIALS = "$env:KOKORO_GFILE_DIR/kokoro-run-key.json"
108+
# Troubleshooting output
109+
Write-Host "GOOGLE_APPLICATION_CREDENTIALS=$env:GOOGLE_APPLICATION_CREDENTIALS"
110+
Write-Host "GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=$env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH"
111+
Write-Host "CURL_CA_BUNDLE=$env:CURL_CA_BUNDLE"
112+
Get-Content "$env:KOKORO_GFILE_DIR/roots.pem" -TotalCount 5
113+
114+
bazelisk $common_flags build $build_flags `
115+
//google/cloud/storage/quickstart:quickstart `
116+
//google/cloud/pubsub/quickstart:quickstart
117+
89118
Invoke-REST-Quickstart
90119
Invoke-gRPC-Quickstart
91120
}

0 commit comments

Comments
 (0)