googleapis / google-cloud-go

Google Cloud Client Libraries for Go.
https://cloud.google.com/go/docs/reference
Apache License 2.0
3.78k stars 1.3k forks source link

fix(auth): skip directpath credentials overwrite when it's not on GCE #10833

Closed xmenxk closed 2 months ago

xmenxk commented 2 months ago

This PR copies over and uses the OnGCE() func from gRPC repo: internal/googlecloud/googlecloud.go This OnGCE() func is based on checking the manufacturer info on local system, and will return false on Serverless.

This change allows us to skip the use of directPath credentials on Serverless.

xmenxk commented 2 months ago

Can you copy/adapt https://github.com/grpc/grpc-go/blob/master/internal/googlecloud/googlecloud_test.go into this PR as well?

moved the unit tests over as well