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

feat: [CI-12041]: add oidc support #6

Merged
merged 15 commits into from
Apr 29, 2024
Merged

feat: [CI-12041]: add oidc support #6

merged 15 commits into from
Apr 29, 2024

Conversation

abhay084
Copy link
Collaborator

@abhay084 abhay084 commented Apr 18, 2024

Tested changes via end-to-end execution with DLC FF enabled and disabled cases.
Tested the execution on Linux Hosted Machine, with 'PL_GCP_OIDC_AUTHENTICATION` FF enabled for OIDC.

Was able to Build a docker image and push it into the GCR repo using the OIDC auth method.
Below are some screen-shots of the executions.

Able to successfully test the changes, please check the jira for more details.
Screenshot 2024-04-24 at 1 26 35 PM
Screenshot 2024-04-24 at 1 26 51 PM

Copy link
Contributor

@rutvijmehta-harness rutvijmehta-harness left a comment

Choose a reason for hiding this comment

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

Initial review.

I would highly recommend make the flows isolated where either it's an OIDC flow or basic auth flow.

internal/gcp/tokenutil.go Outdated Show resolved Hide resolved
internal/gcp/tokenutil.go Outdated Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
Copy link
Contributor

@rutvijmehta-harness rutvijmehta-harness left a comment

Choose a reason for hiding this comment

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

Looks good overall. Let's address the remaining comments.

cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Outdated Show resolved Hide resolved
internal/gcp/tokenutil.go Show resolved Hide resolved
cmd/drone-buildx-gcr/main.go Show resolved Hide resolved
name := "projects/-/serviceAccounts/" + serviceAccountEmail
// rb (request body) specifies parameters for generating an access token.
rb := &iamcredentials.GenerateAccessTokenRequest{
Scope: []string{"https://www.googleapis.com/auth/cloud-platform"},
Copy link

Choose a reason for hiding this comment

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

Use constant here

)

// decode the token if base64 encoded
decoded, err := base64.StdEncoding.DecodeString(password)
Copy link

Choose a reason for hiding this comment

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

add back base64 decoding for password . it will break existing flow otherwise

Copy link

@Sapa96 Sapa96 left a comment

Choose a reason for hiding this comment

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

LGTM

@abhay084 abhay084 merged commit c322e71 into main Apr 29, 2024
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the CI-12041-1 branch April 29, 2024 12:46
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.

4 participants