-
Notifications
You must be signed in to change notification settings - Fork 28
runner
Support GCP OIDC credentials
#506
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 3c919d5.
…ative into gcp-oidc
0x2b3bfa0
reviewed
Apr 19, 2022
0x2b3bfa0
reviewed
Apr 19, 2022
In theory it could be used in the future by task/other resources? I'll
leave that up to you.
…On Tue, Apr 19, 2022, 00:48 Helio Machado ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In iterative/gcp/provider.go
<#506 (comment)>
:
> - return "", nil, errors.New("Couldn't extract the project identifier from the given credentials!")
+ // Coerce Credentials to handle GCP OIDC auth
+ // Common ProjectID ENVs:
+ // https://github.com/google-github-actions/auth/blob/b05f71482f54380997bcc43a29ef5007de7789b1/src/main.ts#L187-L191
+ // https://github.com/hashicorp/terraform-provider-google/blob/d6734812e2c6a679334dcb46932f4b92729fa98c/google/provider.go#L64-L73
+ coercedProjectID := utils.MultiEnvLoadFirst([]string{
+ "CLOUDSDK_CORE_PROJECT",
+ "CLOUDSDK_PROJECT",
+ "GCLOUD_PROJECT",
+ "GCP_PROJECT",
+ "GOOGLE_CLOUD_PROJECT",
+ "GOOGLE_PROJECT",
+ })
+ if coercedProjectID == "" {
+ // last effort to load
+ fromCredentialsID, err := utils.GCPCoerceOIDCCredentials(credentials.JSON)
Oops! Edited, I forgot it was being used from another package. 🙈 Should
this function live perhaps under iterative/gcp/provider.go instead?
—
Reply to this email directly, view it on GitHub
<#506 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIN7MYJ6E7ND4RN5XPDPPTVFY3LHANCNFSM5TN63A4Q>
.
You are receiving this because you were assigned.Message ID:
***@***.***
com>
|
Co-authored-by: Helio Machado <[email protected]>
Works for me, I will de-utils some of these gcp functions. |
0x2b3bfa0
reviewed
Apr 19, 2022
0x2b3bfa0
approved these changes
Apr 19, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am satisfied with the additional testing I have done.