google-github-actions / setup-gcloud

A GitHub Action for installing and configuring the gcloud CLI.
https://cloud.google.com/sdk/docs
Apache License 2.0
1.71k stars 510 forks source link

Spurious warning auth is unavailabe, but gcloud works #670

Closed joshgc closed 8 months ago

joshgc commented 8 months ago

TL;DR

We run out GHA on self-hosted runners on GKE. When using v1 like...

Run google-github-actions/setup-gcloud@v1
  with:
    skip_install: false
    version: latest

we get the following warning

Warning: No authentication found for gcloud, authenticate with `google-github-actions/auth`.

However gcloud works fine.

Detailed design

Looking at the code here, I expect the issue is that no credentials file is present but gcloud is able to find the GCE Metadata server. This seems like a safe path so I'm wondering if we could drop the warning?

Additional information

No response

sethvargo commented 8 months ago

Hi @joshgc - we can definitely change the warning, but we added it because many users were submitting issues when the authentication was missing (often due to skipping actions/checkout or resetting the workspace between steps).

Warnings are just that – warnings. If you know what you're doing and things are working, you can ignore it.

Additionally, I'm not sure what value setup-gcloud is providing in your case. If you're using ADC from the default metadata server on self-hosted runners, you may be better bundling gcloud into your base image and skipping the download; gcloud is quite large and if you've already taken the plunge to use self-hosted runners, you'd see a major performance benefit from skipping this step entirely.

joshgc commented 8 months ago

Thanks @sethvargo agreed its just a warning and so this is not a p0 feature request. So right now we are using the default actions-runner-controller image and not a layer built-ontop of it, which is why we still install gcloud with this action. Then we pull and run a dynamic much more sophisticated image with all of our dependencies that may change from commit-to-commit (eg. python deps in requirements.txt).

How would you feel about checking this method isAuthenticated and then if its false we check and warn on the creds file? https://github.com/google-github-actions/setup-cloud-sdk/blob/main/src/index.ts#L157

joshgc commented 8 months ago

Thanks!