CircleCI-Public / gcp-cli-orb

Install and configure the Google Cloud CLI (gcloud)
https://circleci.com/orbs/registry/orb/circleci/gcp-cli
MIT License
9 stars 32 forks source link

Fails to install components if gcloud came from apt #69

Open mgabeler-lee-6rs opened 1 year ago

mgabeler-lee-6rs commented 1 year ago

Orb version

3.0.1

What happened

We embed steps from this orb in an orb of our own, and so sometimes we end up calling it in a workflow that is running from an image that has at least the base gcloud already installed, such as gcr.io/google.com/cloudsdktool/cloud-sdk, since our orb steps that need gcloud sometimes run in containers without gcloud pre-installed, and sometimes in ones that have it installed.

This orb detects that gcloud is already installed, but then when trying to install the requested components, it always uses gcloud components install ..., which is not allowed when gcloud was installed via apt (or some other package manager). This causes the install step to fail with an error like this:

ERROR: (gcloud.components.install) 
You cannot perform this action because the Google Cloud CLI component manager 
is disabled for this installation. You can run the following command 
to achieve the same result for this installation: 

sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin

Expected behavior

It should install the requested components via apt-get when necessary.

Additional Notes

Google is in the process of trying to transition the name of the "sdk" package to "cli", and the names of the component packages needs to match the main gcloud package, so e.g. if google-cloud-cli is installed, component packages need to be installed as google-cloud-cli-<component>, trying to install google-cloud-sdk-<component> will fail, and vice versa. It doesn't help matters that the error message from gcloud components install always tells you to use the sdk variant even when that's wrong.