Code Monkey home page Code Monkey logo

asdf-gcloud's Introduction

asdf-gcloud Test Lint

GCloud CLI plugin for asdf version manager allowing you to pin gcloud versions for each GCP project.

asdf-gcloud

Contents

Dependencies

Are tracked in lib/dependencies.txt and checked on installation of plugin and asdf install gcloud *. The core dependencies are: bash, curl, python, sort, tar.

Install

Plugin:

asdf plugin add gcloud https://github.com/jthegedus/asdf-gcloud

GCloud:

asdf install gcloud latest

Set global version:

asdf global gcloud latest

These commands also apply to asdf local gcloud <version>.

Why?

The asdf config file, .tool-versions, allows pinning each tool in your project to a specific version. This ensures that ALL developers are using the same version of each tool. Same python, same gcloud, same terraform etc.

When you update a version in .tool-versions, asdf will prompt all users who do not have the correct versions to upgrade. This enables whole teams to update their tools in unison.

Supported Versions

gcloud releases from 352.0.0 and higher can be installed.

Default Cloud SDK Components

asdf-gcloud can automatically install a set of Cloud SDK Components after each asdf install gcloud <version>. To enable this feature you must have a file that lists one COMPONENT_ID per line. For example:

alpha
beta
cloud-build-local
cloud-firestore-emulator

This file must be named .default-cloud-sdk-components and be at one of the following locations:

  • $CLOUDSDK_CONFIG/.default-cloud-sdk-components: next to gcloud auth configurations
  • $HOME/.config/gcloud/.default-cloud-sdk-components: next to gcloud auth configurations
  • $(dirname ASDF_CONFIG_FILE)/.default-cloud-sdk-components: relative to .asdfrc if configured
  • $HOME/.default-cloud-sdk-components: Home dir

NOTE: by default CLOUDSDK_CONFIG=$HOME/.config/gcloud

Below is the list of available components (as of version 342.0.0):

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                 Components                                                 │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬──────────┤
│     Status    │                         Name                         │            ID            │   Size   │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼──────────┤
│ Not Installed │ App Engine Go Extensions                             │ app-engine-go            │  4.9 MiB │
│ Not Installed │ Appctl                                               │ appctl                   │ 21.0 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                      │  7.7 MiB │
│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                 │  6.6 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool                      │ datalab                  │  < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │ 18.4 MiB │
│ Not Installed │ Cloud Firestore Emulator                             │ cloud-firestore-emulator │ 40.5 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │ 60.4 MiB │
│ Not Installed │ Cloud SQL Proxy                                      │ cloud_sql_proxy          │  7.6 MiB │
│ Not Installed │ Cloud Spanner Emulator                               │ cloud-spanner-emulator   │ 21.8 MiB │
│ Not Installed │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │ 14.5 MiB │
│ Not Installed │ Google Cloud Build Local Builder                     │ cloud-build-local        │  6.3 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │  1.8 MiB │
│ Not Installed │ Kustomize                                            │ kustomize                │ 25.9 MiB │
│ Not Installed │ Minikube                                             │ minikube                 │ 50.4 MiB │
│ Not Installed │ Nomos CLI                                            │ nomos                    │ 22.9 MiB │
│ Not Installed │ On-Demand Scanning API extraction helper             │ local-extract            │ 13.6 MiB │
│ Not Installed │ Skaffold                                             │ skaffold                 │ 16.8 MiB │
│ Not Installed │ anthos-auth                                          │ anthos-auth              │ 16.8 MiB │
│ Not Installed │ config-connector                                     │ config-connector         │ 44.6 MiB │
│ Not Installed │ gcloud Alpha Commands                                │ alpha                    │  < 1 MiB │
│ Not Installed │ gcloud Beta Commands                                 │ beta                     │  < 1 MiB │
│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java          │ 52.4 MiB │
│ Not Installed │ gcloud app Python Extensions                         │ app-engine-python        │  6.1 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │ 27.1 MiB │
│ Not Installed │ kpt                                                  │ kpt                      │ 11.7 MiB │
│ Not Installed │ kubectl                                              │ kubectl                  │  < 1 MiB │
│ Not Installed │ kubectl-oidc                                         │ kubectl-oidc             │ 16.8 MiB │
│ Not Installed │ pkg                                                  │ pkg                      │          │
│ Installed     │ BigQuery Command Line Tool                           │ bq                       │  < 1 MiB │
│ Installed     │ Cloud SDK Core Libraries                             │ core                     │ 18.6 MiB │
│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                   │  3.9 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴──────────┘

Contributing

Contributions of any kind welcome! See the contributing guide.

Thanks goes to these contributors!

Why are there Node deps here?

I decided the value of commitlint & sharing Git Hooks with husky were greater than the cost of including these deps. Not only this, but dogfooding asdf for dev deps makes this less of an issue.

License

MIT License © James Hegedus

asdf-gcloud's People

Contributors

adamfeldman avatar dependabot[bot] avatar fiadliel avatar github-actions[bot] avatar gullitmiranda avatar hollow avatar janaaronlee avatar jthegedus avatar mindovermiles262 avatar nklmilojevic avatar rafaelgallani avatar sbocinec avatar tino415 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asdf-gcloud's Issues

gcloud warns about other instances on your system PATH

Describe the bug

gcloud warns about other instances on your system PATH. Is there a way to avoid (or worst case, suppress) this warning?

Steps to reproduce

  1. have a version installed via asdf-gcloud
  2. install another version via asdf-gcloud

Expected behavior

No Warning about other versions to be shown.

Screenshots

✅  gcloud 299.0.0 installed!
ℹ️  Installing SDK Components from /home/jthegedus/.default-cloud-sdk-components


Your current Cloud SDK version is: 299.0.0
Installing components from version: 299.0.0

┌─────────────────────────────────────────────────────────┐
│           These components will be installed.           │
├──────────────────────────────────┬────────────┬─────────┤
│               Name               │  Version   │   Size  │
├──────────────────────────────────┼────────────┼─────────┤
│ Google Cloud Build Local Builder │      0.5.0 │ 6.0 MiB │
│ Google Cloud Build Local Builder │            │         │
│ gcloud Alpha Commands            │ 2019.05.17 │ < 1 MiB │
│ gcloud Beta Commands             │ 2019.05.17 │ < 1 MiB │
└──────────────────────────────────┴────────────┴─────────┘

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Google Cloud Build Local Builder             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Google Cloud Build Local Builder             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud Alpha Commands                        ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud Beta Commands                         ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.                                                                                                                                                                               

Update done!

WARNING:   There are other instances of Google Cloud Platform tools on your system PATH.
  Please remove the following to avoid confusion or accidental invocation:

  /home/jthegedus/.asdf/shims/java_dev_appserver.sh
/home/jthegedus/.asdf/shims/git-credential-gcloud.sh
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/anthoscli
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/docker-credential-gcloud
/home/jthegedus/.asdf/shims/gcloud
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/dev_appserver.py
/home/jthegedus/.asdf/shims/dev_appserver.py
/home/jthegedus/.asdf/shims/gsutil
/home/jthegedus/.asdf/shims/endpointscfg.py
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/bq
/home/jthegedus/.asdf/shims/cloud-build-local
/home/jthegedus/.asdf/shims/anthoscli
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/gsutil
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/gcloud
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/java_dev_appserver.sh
/home/jthegedus/.asdf/shims/docker-credential-gcloud
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/endpointscfg.py
/home/jthegedus/.cache/cloud-code/installer/google-cloud-sdk/bin/git-credential-gcloud.sh
/home/jthegedus/.asdf/shims/bq

  
✅  Cloud SDK Components installed

Additional context

asdf-gcloud doesn't play nice with asdf-direnv

Describe the bug

asdf-gcloud's exec-env assumes it is being run directly, not sourced by asdf-direnv.

Steps to reproduce

  • Install asdf-direnv as per their directions
  • Install asdf-gcloud plugin && any version of asdf-gcloud
  • Set any version of asdf-gcloud global
  • Failure:
...
/home/user/.asdf/plugins/gcloud/bin/exec-env:8: /home/user/.asdf/plugins/direnv/bin/../lib/utils.bash: No such file or directory
...

Expected behavior

direnv: Creating env file /home/user/.asdf/installs/direnv/2.22.0/env/963801998-3676159815-3280331640-4121105084
direnv: loading ~/.asdf/installs/direnv/2.22.0/env/963801998-3676159815-3280331640-4121105084
direnv: using asdf gcloud 311.0.0
...

Additional context

Changing bin/exec-env's line 6 to source "$(dirname "$BASH_SOURCE")/../lib/utils.bash" fixes the problem under asdf-direnv, but likely won't work under no-direnv-asdf.

asdf list-all command returning incorrect version numbers

Describe the bug
Some versions in asdf list-all command are not being returned properly, such as 207.0.0, 208.0.0, and the latest one (325.0.0).
Apparently, looks like the versions are being joined on the same line.

Steps to reproduce
With a clean installation of asdf (or one with the gcloud plugin recently installed), run the default installation steps:

  • asdf plugin add gcloud https://github.com/jthegedus/asdf-gcloud.git;
  • asdf install gcloud latest or asdf list-all.

If you ran asdf install gcloud latest, like I did, the installation will fail.
That is because the script is looking for an unexistent file (version 324.0.0325.0.0). This seems to be happening with only two versions, as mentioned above.

Expected behavior

asdf list-all must return the correct version numbers.

Screenshots
zsh_output.png

gcloud 449.0.0 attempts to install python as root on MacOS

Describe the bug

When attempting to install gcloud 449.0.0, the installer attempts to install a python package, including asking for the root password. On rtx, the install appears to hang, because sudo is waiting for input.

The command attempted is:

sudo installer -target / -pkg ./python-3.10.11-macos11.pkg

The command comes from bin/bootstrapping/install.py

It looks like this can be avoided by running

  --install-python INSTALL_PYTHON
                        (true/false) Attempt to install Python. MacOS only.

It can also be avoided, by using an archive for installation instead of the install script.

This "feature" appears to have been added in either version 330 or 352 of the CLI (see https://cloud.google.com/sdk/docs/release-notes#33000_2021-03-02), and is now triggered by the script looking for a different python version.

Steps to reproduce

  1. rtx --version
    2023.10.1 macos-arm64 (2023-10-05)

  2. rtx use [email protected]

  3. (installation doesn't complete, due to sudo prompt)

Looking for sudo in currently running programs, will show the command referenced in the bug report.

asdf version

rtx 2023.10.1 macos-arm64 (2023-10-05)

asdf-gcloud version

1.2.3

gcloud version

449.0.0

Additional Information

It looks like since version 448(?) the CLI started looking for python3 to be version 3.10 or higher: https://cloud.google.com/sdk/docs/release-notes#44800_2023-09-26

Using a plugin results in "unbound variable"

I have installed gke-gcloud-auth-plugin required for all new Kubernetes clusters from v1.25 and I get this error:

/Users/nkl/.asdf/lib/commands/command-exec.bash: line 23: shim_args[@]: unbound variable
Unable to connect to the server: getting credentials: exec: executable gke-gcloud-auth-plugin failed with exit code 1

It works with gcloud installed via brew.

bug: error during installation with Python 3.10

Describe the bug

Python 3.10 causes the gcloud installation script to fail

Steps to reproduce

  1. asdf install python 3.10.0
  2. asdf local python 3.10.0
  3. asdf install gcloud latest
➜ asdf install gcloud latest
⏬  downloading google-cloud-sdk-360.0.0-linux-x86_64.tar.gz
################################################################################################################## 100.0%
✅  downloaded!
✅  All dependencies found on system!
📦  extracting...
✅  extracted!
🚧  installing...
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
  File "/home/jthegedus/.asdf/installs/gcloud/360.0.0/bin/bootstrapping/install.py", line 12, in <module>
    import bootstrapping
  File "/home/jthegedus/.asdf/installs/gcloud/360.0.0/bin/bootstrapping/bootstrapping.py", line 46, in <module>
    from googlecloudsdk.core.updater import update_manager
  File "/home/jthegedus/.asdf/installs/gcloud/360.0.0/lib/googlecloudsdk/core/updater/update_manager.py", line 39, in <module>
    from googlecloudsdk.core.console import progress_tracker
  File "/home/jthegedus/.asdf/installs/gcloud/360.0.0/lib/googlecloudsdk/core/console/progress_tracker.py", line 651, in <module>
    class _BaseStagedProgressTracker(collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'

asdf version

v0.8.1-a1ef92a

asdf-gcloud version

1.1.0

gcloud version

360.0.0

Additional Information

No response

bug: exec-env does not work when invoked via asdf direnv plugin

Describe the bug

During environment caching, asdf direnv plugin invokes exec-env on all plugins registered in .tool-versions; unfortunately, exec-env is not called via absolute path, so calling gcloud plugin's exec-env results in:

direnv: loading ~/.asdf/plugins/gcloud/bin/exec-env
./exec-env:10: ./lib/utils.bash: No such file or directory

Since that script internally uses dirname and path used to invoke script is relative to current directory (thus, ./exec-env).

Using realpath around "$current_script_path", if available, should solve this issue.

Steps to reproduce

  1. Have .envrc in place
  2. Add use asdf in .envrc, if missing
  3. Ensure that a version for gcloud is declared in asdf, either via .tool-versions or using asdf shell gcloud
  4. Enter direnv allow

asdf version

v0.10.2

asdf-gcloud version

main f59e332

gcloud version

394.0.0

Additional Information

No response

add to asdf-plugins repo

Is your feature request related to a problem? Please describe.

Running

asdf plugin add gcloud

currently does nothing as this repo is not linked to the asdf-plugins repo

Describe the solution you'd like

Link this repo.

Describe alternatives you've considered

NA

Additional context

NA

bug: list-all script is failing with empty error output

Describe the bug

Listing gcloud versions with the current asdf version fails at the moment:

$ asdf list-all gcloud
`Plugin gcloud's list-all callback script failed with output:


$

This is caused as there are no linux- versions returned in some of the pages (as a result of the output pagination) as you can see after you run the list-all script with verbose output using bash -x .asdf/plugins/gcloud/bin/list-all:
image

In this case, both grep commands used to fill the additions variable exits with 1 as there is no match.

Steps to reproduce

stano@sob ~ $ asdf plugin-add gcloud
updating plugin repository...HEAD is now at 8aa2e59 feat: add shorebird plugin (#949)
✅  All dependencies found on system!

stano@sob ~ $ asdf list gcloud
  No versions installed

stano@sob ~ $ asdf list-all gcloud
`Plugin gcloud's list-all callback script failed with output:

asdf version

v0.14.0-ccdd47d

asdf-gcloud version

current HEAD

gcloud version

this is not relevant here

Additional Information

No response

Error on install plugin

When I try install the plugin, this give me the error:
asdf install gcloud latest
mkdir: cannot create directory ‘/home/luan/.asdf/downloads/gcloud/311.0.0’: File exists
⏬ downloading google-cloud-sdk-311.0.0-linux-x86_64.tar.gz
###################################################################################################### 100,0%
✅ downloaded!
✅ All dependencies found on system!
📦 extracting...
✅ extracted!
🚧 installing...
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/home/luan/.asdf/installs/gcloud/311.0.0/bin/bootstrapping/install.py", line 12, in
import bootstrapping
File "/home/luan/.asdf/installs/gcloud/311.0.0/bin/bootstrapping/bootstrapping.py", line 44, in
from googlecloudsdk.core.credentials import store as c_store
File "/home/luan/.asdf/installs/gcloud/311.0.0/lib/googlecloudsdk/core/credentials/store.py", line 40, in
from googlecloudsdk.core.credentials import creds as c_creds
File "/home/luan/.asdf/installs/gcloud/311.0.0/lib/googlecloudsdk/core/credentials/creds.py", line 41, in
import sqlite3
File "/home/luan/.asdf/installs/python/3.8.5/lib/python3.8/sqlite3/init.py", line 23, in
from sqlite3.dbapi2 import *
File "/home/luan/.asdf/installs/python/3.8.5/lib/python3.8/sqlite3/dbapi2.py", line 27, in
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

Can you help me?

bug: unbound variable when `gcloud` run without args

Describe the bug

❯ gcloud
/opt/homebrew/opt/asdf/libexec/lib/commands/command-exec.bash: line 23: shim_args[@]: unbound variable

Steps to reproduce

  1. asdf plugin-add gcloud
  2. asdf global gcloud latest
  3. gcloud

asdf version

0.10.2

asdf-gcloud version

1.2.1

gcloud version

403.0.0

Additional Information

I think it might be the same kind of cause as asdf-vm/asdf#522

branding: social template

Is your feature request related to a problem? Please describe.

For nicer sharing on social platforms, it would be ideal to have a social template image for this repo.

Describe the solution you'd like

Make a crisp 1280x640 image for this repo

Describe alternatives you've considered

NA

Additional context

NA

google-cloud-sdk releases lagging behind upstream by one version

Is your feature request related to a problem? Please describe.

Currently (and I'm suspecting in the past, too) the latest release of the SDK is missing from asdf list-all gcloud. Looking at what happens in /bin/list-all and following through to the GCS bucket which release info is parsed from, that makes sense, as currently 335.0.0 is missing. The latest version asdf-gcloud offers is 334.0.0, which is in line with the bucket's contents.

Describe the solution you'd like

I'd like to be able to install the latest release of the SDK. Off the top of my head there's a few options to facilitate that:

  • Ask the maintainers of the SDK to include new releases in the archives on release, rather than having a location split between archive and latest - I'm suspecting there's a reason they don't already do that
  • Assume that the bucket is lagging behind by one version and account for that in /bin/list-all - this is pretty dirty, even if one was to add something along the lines of curl -X HEAD https://...one_version_higher.tar.gz, as it might break in the future
  • Look for an alternate location of releases - I haven't been able to find the SDK on their Github except for the containerized variant of it

Describe alternatives you've considered

See above.

Additional context

Depending on the proposed solution I'm able to help with implementing this.

bug: Won't upgrade past version 403

Describe the bug

For some reason, it won't upgrade past 403. When I look at the google gcs bucket, its up to 407. (current as of now)

Steps to reproduce

asdf list all gcloud

asdf version

v0.10.2-7e7a1fa

asdf-gcloud version

?

gcloud version

403.0.0

Additional Information

No response

Install Cloud SDK components automatically on new version from config file

Is your feature request related to a problem? Please describe.

Cloud SDK is installed with only gcloud, gsutil, bq and core. It would be good if we could configure automatic installation of other components when asdf install gcloud <version> is run.

Describe the solution you'd like

Install a list of components from a configuration file.

Similar to asdf-nodejs' default npm packages

Describe alternatives you've considered

Additional context

  • May need to automatically reshim afterwards as new binaries are installed to bin/.
  • Dependencies of the components should also be checked before they're installed.

Utilise new asdf plugin documentation hooks

Is your feature request related to a problem? Please describe.

asdf introduced documentation hooks for deps etc for plugins, we should utilise them here.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

verify gcloud download with checksum

Is your feature request related to a problem? Please describe.

Currently the tar.gz of gcloud downloaded from GCS is not verified once downloaded. It should be checked against a hash to ensure it was downloaded correctly.

Describe the solution you'd like

GCP Storage APIs for GCS Object Get support fetching a crc32c and md5Hash field in the metadata. We should leverage those to ensure the file is correct once downloaded.

Describe alternatives you've considered

NA

Additional context

Google recommends using crc32c over md5. Importantly, crc32c is NOT the same as crc32.

Update to asdf 0.8.0 plugin API

Is your feature request related to a problem? Please describe.

asdf 0.8.0 has support for documentation callbacks https://asdf-vm.com/#/plugins-create?id=optional-scripts

  • bin/help.overview - This script should output a general description about the plugin and the tool being managed. No heading should be printed as asdf will print headings. Output may be free-form text but ideally only one short paragraph. This script must be present if you want asdf to provide help information for your plugin. All other help callback scripts are optional.
  • bin/help.deps - This script should output the list of dependencies tailored to the operating system. One dependency per line.
  • bin/help.config - This script should print any required or optional configuration that may be available for the plugin and tool. Any environment variables or other flags needed to install or compile the tool (for the users operating system when possible). Output can be free-form text.
  • bin/help.links - This should be a list of links relevant to the plugin and tool (again, tailored to the current operating system when possible). One link per line. Lines may be in the format <title>: or just .

Describe the solution you'd like

Implement these scripts

Describe alternatives you've considered

Additional context

Might have to rethink existing solutions to deps etc.

Git Hooks with commitlint via Husky

Is your feature request related to a problem? Please describe.

Using commitlint with husky to ensure commit msgs that allow automated releasing of versions

Describe the solution you'd like

Describe alternatives you've considered

Additional context

bug: Using gcloud without any parameters will crash

Describe the bug

I have a fresh installation of MacOS and asdf on a Macbook where I have ran following:

# On MacOS 13.1 (22C65)
$ brew install asdf
$ asdf plugin add gcloud
$ asdf plugin add python
$ asdf install python 3.11.1
$ asdf install gcloud 415.0.0

I'm using fish shell with these lines in my ~/.config/fish/config.fish:

# Use asdf installed with homebrew
if type -q brew
  if type -q asdf
    source (brew --prefix asdf)/libexec/asdf.fish
  end
end

# Add fish completions from homebrew
if test -d /opt/homebrew/share/fish/vendor_completions.d
    source /opt/homebrew/share/fish/vendor_completions.d/*.fish
end
if test -d /opt/homebrew/share/fish/vendor_functions.d
    source /opt/homebrew/share/fish/vendor_functions.d/*.fish
end

When I run just bare gcloud I get following error:

$ gcloud
/opt/homebrew/opt/asdf/libexec/lib/commands/command-exec.bash: line 23: shim_args[@]: unbound variable

I would have expected to get list of all gcloud commands instead.

When I run command with parameters eg:

$ gcloud auth login

It works just fine.

I'm not sure if this is failure on my configuration but seems that something is wrong with the /opt/homebrew/opt/asdf/libexec/lib/commands/command-exec.bash

For example if I run python installed with asdf I don't get any problems:

$ which python
~/.asdf/shims/python
$ python
Python 3.11.1 (main, Jan 27 2023, 08:09:37) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Steps to reproduce

$ asdf gcloud --version
Unknown command: `asdf gcloud --version`
No documentation for plugin gcloud

asdf version

v0.11.1

asdf-gcloud version

v1.2.2

gcloud version

415.0.0

Additional Information

No response

Support `latest` as a special case version

Is your feature request related to a problem? Please describe.

Support installing the latest version of gcloud for better use with dotfiles etc.

Describe the solution you'd like

Users can install the latest version of gcloud by providing latest to asdf install gcloud latest.

⚠️ This would only apply to asdf install and not asdf global as the specific version should still be used there, to discourage pinning to a latest version.

Describe alternatives you've considered

Additional context

Docs would advise doing:

asdf global gcloud ${$(asdf where gcloud)##*/}

asdf where gcloud returns the full path to the installed version, which is:

/Users/<user>/.asdf/installs/<plugin>/<version>/

So that will correctly slice the version of the current gcloud from the path.

gcloud completions

Is your feature request related to a problem? Please describe.

GCloud supports shell autocompletions. It outputs the setup at the end of installation. However, the path to the completions changes with each version and is therefore unmaintainable when changing gcloud versions across projects.

Describe the solution you'd like

asdf-gcloud should output correct recommendations for sourcing shell completions.

Describe alternatives you've considered

NA

Additional context

Screen Shot 2020-03-05 at 8 10 30 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.