Skip to content

Commit

Permalink
Merge pull request #40 from shikanime/pr40
Browse files Browse the repository at this point in the history
Add Google Cloud SDK components install
  • Loading branch information
shikanime authored Aug 29, 2024
2 parents b7c8dd5 + 325dc34 commit 44fe81a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/google-cloud-sdk/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"name": "Google Cloud SDK",
"id": "google-cloud-sdk",
"version": "1.3.0",
"version": "1.4.0",
"description": "Google Cloud SDK",
"options": {
"components": {
"type": "string",
"default": "",
"description": "Comma-separated list of components to install. Leave empty to install all components."
}
},
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -18,4 +25,4 @@
"ghcr.io/devcontainers/features/common-utils",
"ghcr.io/devcontainers/features/python"
]
}
}
10 changes: 10 additions & 0 deletions src/google-cloud-sdk/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

COMPONENTS="${COMPONENTS//,/ }"

export CLOUDSDK_INSTALL_DIR="${INSTALLPATH:-"/usr/local/google-cloud-sdk"}"

USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
Expand Down Expand Up @@ -39,6 +41,14 @@ fi
curl -fsSL https://sdk.cloud.google.com | bash -s -- \
--disable-prompts

# Install list of components if specified
if [ ! -z "${COMPONENTS}" ] && [ "${COMPONENTS}" != "none" ]; then
su ${USERNAME} -c "
${CLOUDSDK_INSTALL_DIR}/google-cloud-sdk/bin/gcloud \
components install \"${COMPONENTS}\"
"
fi

# Create gcloud group, dir, and set sticky bit
if ! cat /etc/group | grep -e "^gcloud:" >/dev/null 2>&1; then
groupadd -r gcloud
Expand Down

0 comments on commit 44fe81a

Please sign in to comment.