Last active
April 16, 2024 14:03
-
-
Save oofnikj/7a2fb1e6b20b397775d882ecd8980159 to your computer and use it in GitHub Desktop.
Download and install latest google-cloud-sdk on Alpine / Debian / Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
###### | |
# Tested with various flavors of Alpine, Ubuntu and Debian. CentOS / RedHat not supported (yet). | |
# Use: | |
# wget -qO- https://gist.githubusercontent.com/oofnikj/7a2fb1e6b20b397775d882ecd8980159/raw | sh | |
###### | |
SDK_DIR=/usr/local/lib | |
which apt && apt update && apt install -y wget jq python3 ca-certificates --no-install-recommends || true | |
which apk && apk update && apk add wget jq python3 ca-certificates || true | |
wget -qO- \ | |
"https://www.googleapis.com/storage/v1/b/cloud-sdk-release/o?prefix=google-cloud-sdk-2" \ | |
| jq -r '.items[].selfLink | select ( match ("linux-x86_64") )' \ | |
| tail -n1 \ | |
| wget -qO- $(awk '{print $1"?alt=media"}') | tar xzf - -C $SDK_DIR | |
/usr/local/lib/google-cloud-sdk/install.sh --quiet | |
echo "export PATH=$SDK_DIR/google-cloud-sdk/bin:$PATH" | tee -a /etc/profile.d/gcloud-sdk.sh | |
. /etc/profile | |
gcloud version |
Traceback (most recent call last): File "/usr/local/lib/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in import bootstrapping File "/usr/local/lib/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 46, in from googlecloudsdk.core.updater import update_manager File "/usr/local/lib/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 39, in from googlecloudsdk.core.console import progress_tracker File "/usr/local/lib/google-cloud-sdk/lib/googlecloudsdk/core/console/progress_tracker.py", line 631, in class _BaseStagedProgressTracker(collections.Mapping): ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'collections' has no attribute 'Mapping'
Had the same issue, you need to use python 3.9 or lower
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Traceback (most recent call last):
File "/usr/local/lib/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in
import bootstrapping
File "/usr/local/lib/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 46, in
from googlecloudsdk.core.updater import update_manager
File "/usr/local/lib/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 39, in
from googlecloudsdk.core.console import progress_tracker
File "/usr/local/lib/google-cloud-sdk/lib/googlecloudsdk/core/console/progress_tracker.py", line 631, in
class _BaseStagedProgressTracker(collections.Mapping):
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Mapping'