Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ of what it's like to use one of these C++ libraries.

```cc
#include "google/cloud/storage/client.h"
#include "google/cloud/common_options.h"
#include <cstdlib>
#include <iostream>
#include <string>

Expand All @@ -41,7 +43,17 @@ int main(int argc, char* argv[]) {

// Create a client to communicate with Google Cloud Storage. This client
// uses the default configuration for authentication and project id.
auto client = google::cloud::storage::Client();
auto options = google::cloud::Options{};

// If the CURL_CA_BUNDLE environment variable is set, configure the client
// to use it. This is required for the Windows CI environment where standard
// system roots may not be sufficient or accessible by the hermetic build.
auto const* ca_bundle = std::getenv("CURL_CA_BUNDLE");
if (ca_bundle != nullptr) {
options.set<google::cloud::CARootsFilePathOption>(ca_bundle);
}

auto client = google::cloud::storage::Client(options);

auto writer = client.WriteObject(bucket_name, "quickstart.txt");
writer << "Hello World!";
Expand Down
10 changes: 8 additions & 2 deletions ci/kokoro/windows/builds/bazel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,19 @@ $test_flags = $build_flags
$test_flags += @("--test_output=errors", "--verbose_failures=true")

Write-Host "`n$(Get-Date -Format o) Compiling and running unit tests"
bazelisk $common_flags test $test_flags --test_tag_filters=-integration-test ...
# See #15678
$exclude_build_targets = @("-//google/cloud/bigtable:internal_query_plan_test", `
"-//google/cloud/storage/tests:storage_include_test-default", `
"-//google/cloud/storage/tests:storage_include_test-grpc-metadata", `
"-//google/cloud/pubsub/samples:all")
bazelisk $common_flags test $test_flags --test_tag_filters=-integration-test ... -- $exclude_build_targets
if ($LastExitCode) {
Write-Host -ForegroundColor Red "bazel test failed with exit code ${LastExitCode}."
Exit ${LastExitCode}
}

Write-Host "`n$(Get-Date -Format o) Compiling extra programs with bazel $common_flags build $build_flags ..."
bazelisk $common_flags build $build_flags ...
bazelisk $common_flags build $build_flags ... -- $exclude_build_targets
if ($LastExitCode) {
Write-Host -ForegroundColor Red "bazel build failed with exit code ${LastExitCode}."
Exit ${LastExitCode}
Expand Down Expand Up @@ -80,6 +85,7 @@ if (Test-Integration-Enabled) {
Write-Host "`n$(Get-Date -Format o) Running minimal quickstart prorams"
Install-Roots-Pem
${env:GRPC_DEFAULT_SSL_ROOTS_FILE_PATH}="${env:KOKORO_GFILE_DIR}/roots.pem"
${env:CURL_CA_BUNDLE}="${env:KOKORO_GFILE_DIR}/roots.pem"
${env:GOOGLE_APPLICATION_CREDENTIALS}="${env:KOKORO_GFILE_DIR}/kokoro-run-key.json"
Invoke-REST-Quickstart
Invoke-gRPC-Quickstart
Expand Down
14 changes: 13 additions & 1 deletion google/cloud/storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ this library.

```cc
#include "google/cloud/storage/client.h"
#include "google/cloud/common_options.h"
#include <cstdlib>
#include <iostream>
#include <string>

Expand All @@ -35,7 +37,17 @@ int main(int argc, char* argv[]) {

// Create a client to communicate with Google Cloud Storage. This client
// uses the default configuration for authentication and project id.
auto client = google::cloud::storage::Client();
auto options = google::cloud::Options{};

// If the CURL_CA_BUNDLE environment variable is set, configure the client
// to use it. This is required for the Windows CI environment where standard
// system roots may not be sufficient or accessible by the hermetic build.
auto const* ca_bundle = std::getenv("CURL_CA_BUNDLE");
if (ca_bundle != nullptr) {
options.set<google::cloud::CARootsFilePathOption>(ca_bundle);
}

auto client = google::cloud::storage::Client(options);

auto writer = client.WriteObject(bucket_name, "quickstart.txt");
writer << "Hello World!";
Expand Down
14 changes: 13 additions & 1 deletion google/cloud/storage/quickstart/quickstart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

//! [all]
#include "google/cloud/storage/client.h"
#include "google/cloud/common_options.h"
#include <cstdlib>
#include <iostream>
#include <string>

Expand All @@ -27,7 +29,17 @@ int main(int argc, char* argv[]) {

// Create a client to communicate with Google Cloud Storage. This client
// uses the default configuration for authentication and project id.
auto client = google::cloud::storage::Client();
auto options = google::cloud::Options{};

// If the CURL_CA_BUNDLE environment variable is set, configure the client
// to use it. This is required for the Windows CI environment where standard
// system roots may not be sufficient or accessible by the hermetic build.
auto const* ca_bundle = std::getenv("CURL_CA_BUNDLE");
if (ca_bundle != nullptr) {
options.set<google::cloud::CARootsFilePathOption>(ca_bundle);
}

auto client = google::cloud::storage::Client(options);

auto writer = client.WriteObject(bucket_name, "quickstart.txt");
writer << "Hello World!";
Expand Down