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

extract GCP project ID from creds file, remove from config #345

Merged
merged 1 commit into from
Mar 5, 2018

Conversation

skriss
Copy link
Contributor

@skriss skriss commented Mar 2, 2018

Signed-off-by: Steve Kriss steve@heptio.com

As discussed this AM - this pulls the project ID from the (required) credentials file rather than requiring it to be provided in the config. I used this code in diluvian.

@skriss skriss requested review from ncdc and nrb March 2, 2018 00:27
Copy link
Contributor

@ncdc ncdc left a comment

Choose a reason for hiding this comment

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

1 suggestion
LGTM

return "", errors.WithStack(err)
}

var data map[string]interface{}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can do this with an inline (or top level) struct:

type credentials struct {
  ProjectID string `json:"project_id"`
}

var c credentials
if err := json.Unmarshal(credsBytes, &c); err != nil {
  // ...
}

if c.ProjectID == "" {
 // error
}

return c.ProjectID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, yeah, nice - i'll do this

Signed-off-by: Steve Kriss <steve@heptio.com>
@skriss
Copy link
Contributor Author

skriss commented Mar 2, 2018

Gotta actually test this on GCP before merge.

@skriss
Copy link
Contributor Author

skriss commented Mar 2, 2018

OK, tested and works for me!

@ncdc ncdc added this to the v0.8.0 milestone Mar 5, 2018
@ncdc ncdc self-assigned this Mar 5, 2018
@ncdc
Copy link
Contributor

ncdc commented Mar 5, 2018

LGTM

@ncdc ncdc merged commit cc9be44 into vmware-tanzu:master Mar 5, 2018
@skriss skriss deleted the gcp-project branch March 5, 2018 17:50
weshayutin pushed a commit to weshayutin/velero that referenced this pull request Jan 15, 2025
…u#345)

The rework of Makefile to make it more readable and
inclusion of lint as a target as well extract
golangci-lint version from the upstream Dockerfile,
so we test in PROW or locally on the same version as upstream.

Signed-off-by: Michal Pryc <mpryc@redhat.com>
Co-authored-by: Michal Pryc <mpryc@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants