Skip to content

Commit d53f0a4

Browse files
committed
Added google-cloud-sdk
1 parent 4612741 commit d53f0a4

File tree

6 files changed

+111
-1
lines changed

6 files changed

+111
-1
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# macOS
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
6+
# Windows
7+
Thumbs.db
8+
ehthumbs.db
9+
Desktop.ini
10+
$RECYCLE.BIN/
11+

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
# Dev Container Features
22

3-
> This repository contains custom dev container features that enhance my development workflow. The features are located in the `src` directory and include tools and configurations that I frequently use.
3+
> This repository contains custom dev container features that enhance my development workflow. The features are located in the `src` directory and include tools and configurations that I frequently use.
4+
5+
## Features
6+
7+
### Google Cloud SDK
8+
9+
The `google-cloud-sdk` feature installs the Google Cloud SDK and optional additional components.
10+
11+
**NOTE:** Ubuntu 24.04 is currently **not** supported by this feature due to an issue with the `apt` package manager. The issue is being tracked [here]() and will be resolved once a fix is available.
12+
13+
### ngrok
14+
15+
The `ngrok` feature installs the ngrok binary; a globally distributed reverse proxy that secures, protects and accelerates your applications and network services, no matter where you run them.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "google-cloud-sdk",
3+
"id": "google-cloud-sdk",
4+
"version": "1.0.0",
5+
"description": "Installs the Google Cloud SDK and (optional) additional components.",
6+
"options": {
7+
"gcloudExtraPackages": {
8+
"type": "string",
9+
"default": "",
10+
"description": "Comma-separated list of additional Google Cloud SDK components to install. Example: `google-cloud-cli-app-engine-java`"
11+
}
12+
},
13+
"installsAfter": ["ghcr.io/devcontainers/features/common-utils"]
14+
}

src/google-cloud-sdk/install.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Check if the OS is Ubuntu 24.04 and exit with a message if true
5+
if [ -f /etc/os-release ]; then
6+
. /etc/os-release
7+
if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "24.04" ]; then
8+
echo "This feature does not support Ubuntu 24.04 due to a Python version conflict."
9+
exit 1
10+
fi
11+
fi
12+
13+
# Install dependencies
14+
apt-get update && apt-get install -y --no-install-recommends apt-transport-https ca-certificates gnupg curl
15+
16+
# Add the Cloud SDK distribution URI as a package source
17+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
18+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
19+
20+
# Update and install the Google Cloud SDK
21+
apt-get update && apt-get install -y google-cloud-cli ${GCLOUD_EXTRA_PACKAGES}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"test": {
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
4+
"features": {
5+
"google-cloud-sdk": {}
6+
}
7+
}
8+
}

test/google-cloud-sdk/test.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# This test file will be executed against an auto-generated devcontainer.json that
4+
# includes the 'ngrok' Feature with no options.
5+
#
6+
# For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
7+
#
8+
# Eg:
9+
# {
10+
# "image": "<..some-base-image...>",
11+
# "features": {
12+
# "ngrok": {}
13+
# },
14+
# "remoteUser": "root"
15+
# }
16+
#
17+
# These scripts are run as 'root' by default. Although that can be changed
18+
# with the '--remote-user' flag.
19+
#
20+
# This test can be run with the following command:
21+
#
22+
# devcontainer features test \
23+
# --features ngrok \
24+
# --remote-user root \
25+
# --skip-scenarios \
26+
# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \
27+
# /path/to/this/repo
28+
29+
set -e
30+
31+
# Optional: Import test library bundled with the devcontainer CLI
32+
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
33+
# Provides the 'check' and 'reportResults' commands.
34+
source dev-container-features-test-lib
35+
36+
# Feature-specific tests
37+
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
38+
# check <LABEL> <cmd> [args...]
39+
check "gcloud-cli installation" command -v gcloud
40+
check "gcloud-cli version" gcloud --version
41+
42+
# Report results
43+
# If any of the checks above exited with a non-zero exit code, the test will fail.
44+
reportResults

0 commit comments

Comments
 (0)