File tree Expand file tree Collapse file tree 4 files changed +47
-5
lines changed
Expand file tree Collapse file tree 4 files changed +47
-5
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ of what it's like to use one of these C++ libraries.
2828
2929``` cc
3030#include " google/cloud/storage/client.h"
31+ #include " google/cloud/common_options.h"
32+ #include < cstdlib>
3133#include < iostream>
3234#include < string>
3335
@@ -41,7 +43,17 @@ int main(int argc, char* argv[]) {
4143
4244 // Create a client to communicate with Google Cloud Storage. This client
4345 // uses the default configuration for authentication and project id.
44- auto client = google::cloud : :storage::Client();
46+ auto options = google::cloud : :Options{};
47+
48+ // If the CURL_CA_BUNDLE environment variable is set, configure the client
49+ // to use it. This is required for the Windows CI environment where standard
50+ // system roots may not be sufficient or accessible by the hermetic build.
51+ auto const* ca_bundle = std::getenv("CURL_CA_BUNDLE");
52+ if (ca_bundle != nullptr) {
53+ options.set< google::cloud::CARootsFilePathOption > (ca_bundle);
54+ }
55+
56+ auto client = google::cloud : :storage::Client(options);
4557
4658 auto writer = client.WriteObject(bucket_name, "quickstart.txt");
4759 writer << "Hello World!";
Original file line number Diff line number Diff line change @@ -40,14 +40,19 @@ $test_flags = $build_flags
4040$test_flags += @ (" --test_output=errors" , " --verbose_failures=true" )
4141
4242Write-Host " `n $ ( Get-Date - Format o) Compiling and running unit tests"
43- bazelisk $common_flags test $test_flags -- test_tag_filters=- integration- test ...
43+ # See #15678
44+ $exclude_build_targets = @ (" -//google/cloud/bigtable:internal_query_plan_test" , `
45+ " -//google/cloud/storage/tests:storage_include_test-default" , `
46+ " -//google/cloud/storage/tests:storage_include_test-grpc-metadata" , `
47+ " -//google/cloud/pubsub/samples:all" )
48+ bazelisk $common_flags test $test_flags -- test_tag_filters=- integration- test ... -- $exclude_build_targets
4449if ($LastExitCode ) {
4550 Write-Host - ForegroundColor Red " bazel test failed with exit code ${LastExitCode} ."
4651 Exit ${LastExitCode}
4752}
4853
4954Write-Host " `n $ ( Get-Date - Format o) Compiling extra programs with bazel $common_flags build $build_flags ..."
50- bazelisk $common_flags build $build_flags ...
55+ bazelisk $common_flags build $build_flags ... -- $exclude_build_targets
5156if ($LastExitCode ) {
5257 Write-Host - ForegroundColor Red " bazel build failed with exit code ${LastExitCode} ."
5358 Exit ${LastExitCode}
@@ -80,6 +85,7 @@ if (Test-Integration-Enabled) {
8085 Write-Host " `n $ ( Get-Date - Format o) Running minimal quickstart prorams"
8186 Install-Roots - Pem
8287 ${env: GRPC_DEFAULT_SSL_ROOTS_FILE_PATH} = " ${env: KOKORO_GFILE_DIR} /roots.pem"
88+ ${env: CURL_CA_BUNDLE} = " ${env: KOKORO_GFILE_DIR} /roots.pem"
8389 ${env: GOOGLE_APPLICATION_CREDENTIALS} = " ${env: KOKORO_GFILE_DIR} /kokoro-run-key.json"
8490 Invoke-REST - Quickstart
8591 Invoke-gRPC - Quickstart
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ this library.
2222
2323``` cc
2424#include " google/cloud/storage/client.h"
25+ #include " google/cloud/common_options.h"
26+ #include < cstdlib>
2527#include < iostream>
2628#include < string>
2729
@@ -35,7 +37,17 @@ int main(int argc, char* argv[]) {
3537
3638 // Create a client to communicate with Google Cloud Storage. This client
3739 // uses the default configuration for authentication and project id.
38- auto client = google::cloud : :storage::Client();
40+ auto options = google::cloud : :Options{};
41+
42+ // If the CURL_CA_BUNDLE environment variable is set, configure the client
43+ // to use it. This is required for the Windows CI environment where standard
44+ // system roots may not be sufficient or accessible by the hermetic build.
45+ auto const* ca_bundle = std::getenv("CURL_CA_BUNDLE");
46+ if (ca_bundle != nullptr) {
47+ options.set< google::cloud::CARootsFilePathOption > (ca_bundle);
48+ }
49+
50+ auto client = google::cloud : :storage::Client(options);
3951
4052 auto writer = client.WriteObject(bucket_name, "quickstart.txt");
4153 writer << "Hello World!";
Original file line number Diff line number Diff line change 1414
1515// ! [all]
1616#include " google/cloud/storage/client.h"
17+ #include " google/cloud/common_options.h"
18+ #include < cstdlib>
1719#include < iostream>
1820#include < string>
1921
@@ -27,7 +29,17 @@ int main(int argc, char* argv[]) {
2729
2830 // Create a client to communicate with Google Cloud Storage. This client
2931 // uses the default configuration for authentication and project id.
30- auto client = google::cloud::storage::Client ();
32+ auto options = google::cloud::Options{};
33+
34+ // If the CURL_CA_BUNDLE environment variable is set, configure the client
35+ // to use it. This is required for the Windows CI environment where standard
36+ // system roots may not be sufficient or accessible by the hermetic build.
37+ auto const * ca_bundle = std::getenv (" CURL_CA_BUNDLE" );
38+ if (ca_bundle != nullptr ) {
39+ options.set <google::cloud::CARootsFilePathOption>(ca_bundle);
40+ }
41+
42+ auto client = google::cloud::storage::Client (options);
3143
3244 auto writer = client.WriteObject (bucket_name, " quickstart.txt" );
3345 writer << " Hello World!" ;
You can’t perform that action at this time.
0 commit comments