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

`gcp-cli/setup` improperly attempts to uninstall newer versions when requesting latest version #73

Closed novedevo closed 1 year ago

novedevo commented 1 year ago

Orb version

3.0.1

What happened

Using the google/cloud-sdk:latest Docker image and running gcp-cli/setup to authenticate, without specifying a version (i.e. defaulting to "latest"), sometimes causes the orb to detect a version mismatch (when the most recent version of the Google Cloud SDK (https://cloud.google.com/sdk/docs/release-notes) is lower than the most recent version of the Docker Hub image (https://hub.docker.com/r/google/cloud-sdk/tags)). This mismatch causes the orb to attempt to uninstall the Google Cloud SDK, but since the Docker image apparently does not include sudo, this fails, and causes the entire pipeline to fail.

This behaviour makes sense when you specify an individual version, but not the blanket "latest" tag.

https://app.circleci.com/pipelines/bitbucket/siqomega/oddsharvester/390/workflows/524dc159-0bac-405b-8744-3ca7006364ad/jobs/866

The version installed (429.0.0) differs from the version requested (428.0.0).
Uninstalling v429.0.0...
sudo is required to uninstall the Google Cloud SDK.
Please install it and try again.
Failed to uninstall the current version.

Expected behavior

If the configuration file requests the latest version of the Google Cloud SDK, a more recent version being preinstalled should not cause the job to try to uninstall the newer version, and instead should continue as normal.

As well, the orb could provide a way to setup an authenticated Google Cloud SDK environment without attempting to install it, if there is already a version installed.

aprilsourz commented 1 year ago

I'm also experiencing this issue.

alph486 commented 1 year ago

Me too, thoughts: One could argue that the :latest tag should refer to only the latest version of the image which is pinned to a version of the SDK which gets preinstalled. I think in the context of using a docker image it would make the most sense.

w1mvy commented 1 year ago

I have a similar problem too. And I have prepared a PR to add skip_install option and am waiting for a review.

https://github.com/CircleCI-Public/gcp-cli-orb/pull/66