Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GCS credentials when no endpoint specified #138

Merged
merged 3 commits into from
Sep 15, 2020
Merged
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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Fixed Anonymous Credentials Error on public buckets
- [#133](https://github.com/meltwater/drone-cache/pull/133) bacnkend/s3: Fixed Anonymous Credentials Error on public buckets.
- Fixes [#132](https://github.com/meltwater/drone-cache/issues/132)
- [#135](https://github.com/meltwater/drone-cache/issues/135) Fixed parsing of GCS JSON key.
- [#138](https://github.com/meltwater/drone-cache/pull/138) backend/gcs: Fix GCS to pass credentials correctly when `GCS_ENDPOINT` is not set.
- [#135](https://github.com/meltwater/drone-cache/issues/135) backend/gcs: Fixed parsing of GCS JSON key.

### Added

Expand Down
14 changes: 7 additions & 7 deletions storage/backend/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ func New(l log.Logger, c Config) (*Backend, error) {

if c.Endpoint != "" {
opts = append(opts, option.WithEndpoint(c.Endpoint))
}

if !strings.HasPrefix(c.Endpoint, "https://") { // This is not settable from outside world, only used for mock tests.
opts = append(opts, option.WithHTTPClient(&http.Client{Transport: &http.Transport{
// ignore unverified/expired SSL certificates for tests.
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec
}}))
if !strings.HasPrefix(c.Endpoint, "https://") { // This is not settable from outside world, only used for mock tests.
opts = append(opts, option.WithHTTPClient(&http.Client{Transport: &http.Transport{
// ignore unverified/expired SSL certificates for tests.
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec
}}))
}
}

setAuthenticationMethod(l, c, opts)
opts = setAuthenticationMethod(l, c, opts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈


ctx, cancel := context.WithTimeout(context.Background(), c.Timeout)
defer cancel()
Expand Down