Skip to content

Commit f98cb86

Browse files
committed
Fixed issues with ngrok and gcloud install and test scripts
1 parent fe969da commit f98cb86

File tree

8 files changed

+36
-41
lines changed

8 files changed

+36
-41
lines changed

src/google-cloud-sdk/devcontainer-feature.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "google-cloud-sdk",
33
"id": "google-cloud-sdk",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"description": "Installs the Google Cloud SDK and (optional) additional components.",
66
"options": {
77
"gcloudExtraPackages": {
88
"type": "string",
99
"default": "",
10-
"description": "Comma-separated list of additional Google Cloud SDK components to install. Example: `google-cloud-cli-app-engine-java`"
10+
"description": "Comma-separated list of additional Google Cloud SDK components to install. Example: `google-cloud-cli-app-engine-java,kubectl`"
1111
}
1212
},
1313
"installsAfter": ["ghcr.io/devcontainers/features/common-utils"]

src/google-cloud-sdk/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ apt-get update && apt-get install -y --no-install-recommends apt-transport-https
88
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
99
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
1010

11+
# Extract gcloudExtraPackages from environment variables
12+
GCLOUD_EXTRA_PACKAGES=${GCLOUDEXTRAPACKAGES:-}
13+
GCLOUD_EXTRA_PACKAGES=$(echo $GCLOUD_EXTRA_PACKAGES | tr ',' ' ')
14+
1115
# Check if the OS is Ubuntu 24.04 and the architecture is arm64, and exit with a message if true
1216
if [ -f /etc/os-release ]; then
1317
. /etc/os-release

src/ngrok/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ngrok",
33
"id": "ngrok",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"description": "Globally distributed reverse proxy that secures, protects and accelerates your applications and network services, no matter where you run them.",
66
"options": {
77
"authtoken": {

src/ngrok/install.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ install_ngrok() {
4141
&& rm -f ngrok-v3-stable-linux-${ARCH}.tgz
4242
}
4343

44+
# Extract authtoken from environment variables
45+
AUTH_TOKEN=${AUTHTOKEN:-}
46+
4447
configure_ngrok() {
45-
if [ -n "$NG_TOKEN" ]; then
46-
ngrok config add-authtoken "$NG_TOKEN"
48+
if [ -n "$AUTH_TOKEN" ]; then
49+
ngrok config add-authtoken "$AUTH_TOKEN"
4750
fi
4851
}
4952

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library bundled with the devcontainer CLI
6+
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
7+
# Provides the 'check' and 'reportResults' commands.
8+
source dev-container-features-test-lib
9+
10+
# Feature-specific tests
11+
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
12+
# check <LABEL> <cmd> [args...]
13+
check "gcloud-cli installation" command -v gcloud
14+
check "gcloud-cli version" gcloud --version
15+
check "kubectl installation" command -v kubectl
16+
check "kubectl version" kubectl version --client
17+
18+
# Report results
19+
# If any of the checks above exited with a non-zero exit code, the test will fail.
20+
reportResults
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"test": {
2+
"gcloud-extra-packages": {
33
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
44
"features": {
5-
"google-cloud-sdk": {}
5+
"google-cloud-sdk": {
6+
"gcloudExtraPackages": "google-cloud-cli-app-engine-java , kubectl"
7+
}
68
}
79
}
810
}

test/google-cloud-sdk/test.sh

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,5 @@
11
#!/bin/bash
22

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-
293
set -e
304

315
# Optional: Import test library bundled with the devcontainer CLI

test/ngrok/scenarios.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)