-
Notifications
You must be signed in to change notification settings - Fork 321
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
Allow gcr authentication with workload identity #383
Allow gcr authentication with workload identity #383
Conversation
Hey @dhpollack Could you explain how you are generating the token for workload identity? Are you storing it in secrets |
I'm trying to recreate a setup similar to https://github.com/google-github-actions/auth in drone |
To generate a token, you don't necessarily need workload identity. The easiest way to generate a token is to have service account credentials in CI as a secret then run the following gcloud command:
to generate an actual workload identity config you can run the command:
|
Setting up the pool itself is not entirely trivial. We used terraform, but there was a lot of playing around with the settings: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/iam_workload_identity_pool The official google instructions are also helpful to know what all the options are: https://cloud.google.com/iam/docs/workload-identity-federation |
Looking at the docs that you pointed to, you need to create an |
Not sure if this will help get time from maintainers for this PR, but the patch works fine for me. As @dhpollack writes in his initial comment, use of service account key export is not recommended by Google |
@rutvijmehta-harness @tphoney How does one get a PR merge into master here? |
I found a bug with base64 encoded workload identity files, which I fixed. I also found a bug in the drone-ecr plugin where the default value for the env vars was always set to false for booleans. |
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.
Great fix for the bugged method in ecr 🥂
there is a couple of nit picks around variable naming, nothing big.
Also could you squash your commits into either one commit with everything (we can do that at merge time), or 2 commits with the ecr fix in one, and the gcr work in the other. your choice.
thanks for the effort and expertise !!!
@tphoney I do have one more question. Does the documentation for this automatically get generated or do I need to make the changes somewhere? I couldn't find where that was done. |
thanks @dhpollack your go code was fine, it was just to keep it in line with the other code. https://github.com/drone/drone-plugin-index/blob/main/plugins/gcr/content.yaml is the raw documentation for the the plugins website here https://plugins.drone.io/plugins/gcr once again thanks for the change ! |
@tphoney I created a PR for the docs. |
This allows the GCR plugin to use a workload identity federation key. This uses a special type of config file to generate a temporary oauth token for drone. This is recommended by google over using service account keys.