GoogleCloudPlatform / artifact-registry-maven-tools

Apache License 2.0
22 stars 23 forks source link

Documentation omission #50

Closed BruceWilcox closed 2 years ago

BruceWilcox commented 3 years ago

I am using Bitbucket pipelines to build and deploy my java .jar files to Artifact Registry.

Your documentation does not seem to indicate that Google service account credentials (as json) may be placed in a file and an environment variable of GOOGLE_APPLICATION_CREDENTIALS containing the file path name can be set to allow mvn deploy to work.

I wish that the credentials as Base64 could be placed in an environment variable so I don't have to check in the credentials as a file into my Bitbucket project. Your thoughts?

lindsayismith commented 2 years ago

Hi Bruce,

The maven plugin first attempts to find application default credentials, and does so following the steps in these docs: https://cloud.google.com/docs/authentication/production

This does include checking for GOOGLE_APPLICATION_CREDENTIALS environment variable as you suggest. The env variable needs to point to the path containing either a service account key, or a config file.

If the build is running on a GCP VM, it will also try to pick up the service account running the VM by using the metadata service.

Please try this and report back. If it's not working we can try and debug.

yihanzhen commented 2 years ago

I'm going to close this issue due to inactivity. Feel free to let us know if it doesn't work.