GoogleCloudPlatform / artifact-registry-maven-tools

Apache License 2.0
22 stars 23 forks source link

Slow build when ADC is not available #74

Closed rravi-sift closed 2 years ago

rravi-sift commented 2 years ago

When running a Gradle build with multiple sub-projects, we are noticing a considerable delay because the plugin authorizes with artifact registry in each module, and in each module, we see it first error out on ADC authorization and then fall back to gcloud.

In the DefaultCredentialProvider, the ADC is tried first and on error, it falls back to gcloud credential. Is it possible to escape the ADC check and go directly to gcloud credentials?

When setting credentials using GOOGLE_APPLICATION_CREDENTIALS (forcing ADC) the build step takes 17s. When using gcloud auth activate-service-account, the build takes 8 times longer. Because of the CI config we use, there is no option to set GOOGLE_APPLICATION_CREDENTIALS

rravi-sift commented 2 years ago

With the fix done in https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/issues/26 and by moving the plugin initialization to settings.gradle as mentioned in https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools#alternatives, the configuration time was reduced considerably.