Skip to content

Commit 5c4dd5b

Browse files
committed
fix: quickstart env variables
1 parent eb0d822 commit 5c4dd5b

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

ci/kokoro/windows/builds/bazel.ps1

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,32 +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+
param($bazel_bin)
66+
try {
67+
$executable = "$bazel_bin/google/cloud/storage/quickstart/quickstart.exe"
68+
$executable = $executable.Replace('/', '\')
69+
Write-Host "Running REST Quickstart, executable found at: $executable"
70+
& $executable "${env:GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME}"
71+
if ($LastExitCode) {
72+
Write-Host -ForegroundColor Red "bazel run (storage/quickstart) failed with exit code ${LastExitCode}."
73+
Exit ${LastExitCode}
74+
}
75+
} catch {
76+
Write-Host -ForegroundColor Red "Caught exception while trying to run storage/quickstart: $_"
77+
Exit 1
7178
}
7279
}
7380

7481
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}
82+
param($bazel_bin)
83+
try {
84+
$executable = "$bazel_bin/google/cloud/pubsub/quickstart/quickstart.exe"
85+
$executable = $executable.Replace('/', '\')
86+
Write-Host "Running gRPC Quickstart, executable found at: $executable"
87+
& $executable "${env:GOOGLE_CLOUD_PROJECT}" "${env:GOOGLE_CLOUD_CPP_PUBSUB_TEST_QUICKSTART_TOPIC}"
88+
if ($LastExitCode) {
89+
Write-Host -ForegroundColor Red "bazel run (pubsub/quickstart) failed with exit code ${LastExitCode}."
90+
Exit ${LastExitCode}
91+
}
92+
} catch {
93+
Write-Host -ForegroundColor Red "Caught exception while trying to run pubsub/quickstart: $_"
94+
Exit 1
8195
}
8296
}
8397

8498
if (Test-Integration-Enabled) {
8599
Write-Host "`n$(Get-Date -Format o) Running minimal quickstart prorams"
86100
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"
89-
Invoke-REST-Quickstart
90-
Invoke-gRPC-Quickstart
101+
$env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH = "$env:KOKORO_GFILE_DIR/roots.pem"
102+
$env:CURL_CA_BUNDLE = "$env:KOKORO_GFILE_DIR/roots.pem"
103+
$env:GOOGLE_APPLICATION_CREDENTIALS = "$env:KOKORO_GFILE_DIR/kokoro-run-key.json"
104+
# Troubleshooting output
105+
Write-Host "GOOGLE_APPLICATION_CREDENTIALS=$env:GOOGLE_APPLICATION_CREDENTIALS"
106+
Write-Host "GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=$env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH"
107+
Write-Host "CURL_CA_BUNDLE=$env:CURL_CA_BUNDLE"
108+
Get-Content "$env:KOKORO_GFILE_DIR/roots.pem" -TotalCount 5
109+
110+
bazelisk $common_flags build $build_flags `
111+
//google/cloud/storage/quickstart:quickstart `
112+
//google/cloud/pubsub/quickstart:quickstart
113+
114+
$bazel_bin = (bazelisk info bazel-bin).Trim()
115+
Write-Host "bazel-bin directory: $bazel_bin"
116+
Invoke-REST-Quickstart $bazel_bin
117+
Invoke-gRPC-Quickstart $bazel_bin
91118
}
92119

93120
# Shutdown the Bazel server to release any locks

0 commit comments

Comments
 (0)