-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Try Google Application Default Credentials for GCR (gcr.io) auth #1902
Conversation
Out of the draft status. Ready for review. |
jib-core/src/main/java/com/google/cloud/tools/jib/frontend/CredentialRetrieverFactory.java
Outdated
Show resolved
Hide resolved
jib-core/src/main/java/com/google/cloud/tools/jib/frontend/CredentialRetrieverFactory.java
Outdated
Show resolved
Hide resolved
jib-core/src/main/java/com/google/cloud/tools/jib/frontend/CredentialRetrieverFactory.java
Outdated
Show resolved
Hide resolved
@@ -65,7 +63,7 @@ public DockerCredentialHelper(String serverUrl, Path credentialHelper) { | |||
} | |||
|
|||
DockerCredentialHelper(String registry, String credentialHelperSuffix) { | |||
this(registry, Paths.get(CREDENTIAL_HELPER_PREFIX + credentialHelperSuffix)); | |||
this(registry, Paths.get("docker-credential-" + credentialHelperSuffix)); |
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.
I wonder if we should get rid of this method and push knowledge of the docker-credential-
prefix to the callers/creators?
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.
Let me take care of this in a separate PR. (#1920)
jib-core/src/main/java/com/google/cloud/tools/jib/frontend/CredentialRetrieverFactory.java
Show resolved
Hide resolved
...mon/src/main/java/com/google/cloud/tools/jib/plugins/common/DefaultCredentialRetrievers.java
Show resolved
Hide resolved
jib-core/src/main/java/com/google/cloud/tools/jib/frontend/CredentialRetrieverFactory.java
Show resolved
Hide resolved
jib-core/src/main/java/com/google/cloud/tools/jib/frontend/CredentialRetrieverFactory.java
Show resolved
Hide resolved
jib-core/src/main/java/com/google/cloud/tools/jib/frontend/CredentialRetrieverFactory.java
Outdated
Show resolved
Hide resolved
...mon/src/main/java/com/google/cloud/tools/jib/plugins/common/DefaultCredentialRetrievers.java
Show resolved
Hide resolved
...src/test/java/com/google/cloud/tools/jib/plugins/common/DefaultCredentialRetrieversTest.java
Outdated
Show resolved
Hide resolved
4273376
to
e0bdcde
Compare
Fixes #1903.
Closes #1500.
ADC from Cloud SDK
Jib can get ADC set through
gcloud auth application-default login
. ADC in this case are "end user credentials".ADC from Service Account
The current implementation for a service account is to generate a short-lived OAuth2 access token from the service account and use it for GCR auth.
ADC on Google Cloud Build (GCB)
ADC are available on GCB and have the permission to push to GCR.
ADC on Google Compute Engine (GCE)
Tested on Linux and Windows:
ADC on Google Kubernetes Engine (GKE)
See #1903 for details.
ADC on Cloud Shell
Confirmed it works. However, Cloud Shell has
docker-credential-gcloud
,docker-credential-gcr
, and~/.docker/config.json
, so it's already working pretty well without this ADC support.