Skip to content

Commit 1bed252

Browse files
committed
fix: quickstart env variables
1 parent 8c7fb15 commit 1bed252

File tree

1 file changed

+60
-16
lines changed

1 file changed

+60
-16
lines changed

ci/kokoro/windows/builds/bazel.ps1

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,32 +62,76 @@ 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 = Join-Path $bazel_bin "google/cloud/storage/quickstart/quickstart.exe"
68+
Write-Host "Running REST Quickstart, attempting to run: $executable"
69+
if (-not (Test-Path $executable)) {
70+
Write-Host -ForegroundColor Red "Executable not found at the specified path."
71+
Exit 1
72+
}
73+
& $executable "${env:GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME}"
74+
if ($LastExitCode) {
75+
Write-Host -ForegroundColor Red "Execution of (storage/quickstart) failed with exit code ${LastExitCode}."
76+
Exit ${LastExitCode}
77+
}
78+
} catch {
79+
Write-Host -ForegroundColor Red "Caught exception while trying to run storage/quickstart: $_"
80+
Exit 1
7181
}
7282
}
7383

7484
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}
85+
param($bazel_bin)
86+
try {
87+
$executable = Join-Path $bazel_bin "google/cloud/pubsub/quickstart/quickstart.exe"
88+
Write-Host "Running gRPC Quickstart, attempting to run: $executable"
89+
if (-not (Test-Path $executable)) {
90+
Write-Host -ForegroundColor Red "Executable not found at the specified path."
91+
Exit 1
92+
}
93+
& $executable "${env:GOOGLE_CLOUD_PROJECT}" "${env:GOOGLE_CLOUD_CPP_PUBSUB_TEST_QUICKSTART_TOPIC}"
94+
if ($LastExitCode) {
95+
Write-Host -ForegroundColor Red "Execution of (pubsub/quickstart) failed with exit code ${LastExitCode}."
96+
Exit ${LastExitCode}
97+
}
98+
} catch {
99+
Write-Host -ForegroundColor Red "Caught exception while trying to run pubsub/quickstart: $_"
100+
Exit 1
81101
}
82102
}
83103

84104
if (Test-Integration-Enabled) {
85105
Write-Host "`n$(Get-Date -Format o) Running minimal quickstart prorams"
86106
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
107+
$env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH = Join-Path $env:KOKORO_GFILE_DIR "roots.pem"
108+
$env:CURL_CA_BUNDLE = Join-Path $env:KOKORO_GFILE_DIR "roots.pem"
109+
$env:GOOGLE_APPLICATION_CREDENTIALS = Join-Path $env:KOKORO_GFILE_DIR "kokoro-run-key.json"
110+
# Troubleshooting output
111+
Write-Host "GOOGLE_APPLICATION_CREDENTIALS=$env:GOOGLE_APPLICATION_CREDENTIALS"
112+
Write-Host "GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=$env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH"
113+
Write-Host "CURL_CA_BUNDLE=$env:CURL_CA_BUNDLE"
114+
Get-Content (Join-Path $env:KOKORO_GFILE_DIR "roots.pem") -TotalCount 5
115+
116+
bazelisk $common_flags build $build_flags `
117+
//google/cloud/storage/quickstart:quickstart `
118+
//google/cloud/pubsub/quickstart:quickstart
119+
120+
$bazel_bin = (bazelisk $common_flags info $build_flags bazel-bin).Trim()
121+
$bazel_bin = $bazel_bin.Replace('/', '\')
122+
Write-Host "bazel-bin directory: $bazel_bin"
123+
124+
# DEBUG START: List all quickstart.exe files found in the output directory
125+
Write-Host "DEBUG: Searching for 'quickstart.exe' in $bazel_bin..."
126+
try {
127+
Get-ChildItem -Path $bazel_bin -Filter "quickstart.exe" -Recurse -ErrorAction SilentlyContinue | ForEach-Object { Write-Host "Found: $($_.FullName)" }
128+
} catch {
129+
Write-Host "DEBUG: Failed to list contents of $bazel_bin"
130+
}
131+
# DEBUG END
132+
133+
Invoke-REST-Quickstart $bazel_bin
134+
Invoke-gRPC-Quickstart $bazel_bin
91135
}
92136

93137
# Shutdown the Bazel server to release any locks

0 commit comments

Comments
 (0)