Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/google-cloud-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
],
"default": "latest",
"description": "Select or enter a gcloud CLI version"
},
"installGkeGcloudAuthPlugin": {
"type": "boolean",
"default": true,
"description": "Install 'gke-gcloud-auth-plugin' plugin?"
}
},
"installsAfter": [
Expand Down
9 changes: 8 additions & 1 deletion src/google-cloud-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -e
rm -rf /var/lib/apt/lists/*

GCLOUD_VERSION=${VERSION:-"latest"}
INSTALL_GKEGCLOUDAUTH_PLUGIN="${INSTALL_GKEGCLOUDAUTH_PLUGIN:-"false"}"

if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
Expand Down Expand Up @@ -87,6 +88,12 @@ install_using_apt() {
rm -f /etc/apt/sources.list.d/google-cloud-sdk.list
return 1
fi

# Install gke-gcloud-auth-plugin if needed
if [ "${INSTALL_GKEGCLOUDAUTH_PLUGIN}" = "true" ]; then
echo "(*) Installing 'gke-gcloud-auth-plugin' plugin..."
check_packages google-cloud-sdk-gke-gcloud-auth-plugin
fi
}

echo "(*) Installing google-cloud CLI..."
Expand All @@ -98,4 +105,4 @@ install_using_apt
# Clean up
rm -rf /var/lib/apt/lists/*

echo "Done!"
echo "Done!"