From 44623a39eb046792948420578ae7a92983ec6502 Mon Sep 17 00:00:00 2001 From: Mattia Panzeri <1754457+panz3r@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:09:15 +0000 Subject: [PATCH 1/2] chore: remove `color` sample feature Remove template feature and tests --- .github/workflows/test.yaml | 2 - src/color/README.md | 26 ------------- src/color/devcontainer-feature.json | 21 ----------- src/color/install.sh | 26 ------------- test/_global/color_and_hello.sh | 33 ----------------- test/_global/scenarios.json | 13 ------- test/color/gold.sh | 17 --------- test/color/green.sh | 17 --------- test/color/my_favorite_color_is_green.sh | 31 ---------------- test/color/scenarios.json | 33 ----------------- test/color/test.sh | 47 ------------------------ 11 files changed, 266 deletions(-) delete mode 100644 src/color/README.md delete mode 100644 src/color/devcontainer-feature.json delete mode 100644 src/color/install.sh delete mode 100644 test/_global/color_and_hello.sh delete mode 100644 test/_global/scenarios.json delete mode 100644 test/color/gold.sh delete mode 100644 test/color/green.sh delete mode 100644 test/color/my_favorite_color_is_green.sh delete mode 100644 test/color/scenarios.json delete mode 100644 test/color/test.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5224dcb..77df34a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,7 +14,6 @@ jobs: matrix: features: - go-mod-cache - - color - hello baseImage: - debian:latest @@ -36,7 +35,6 @@ jobs: matrix: features: - go-mod-cache - - color - hello steps: - uses: actions/checkout@v4 diff --git a/src/color/README.md b/src/color/README.md deleted file mode 100644 index a1e7d1b..0000000 --- a/src/color/README.md +++ /dev/null @@ -1,26 +0,0 @@ - -# My Favorite Color (color) - -A feature to remind you of your favorite color - -## Example Usage - -```json -"features": { - "ghcr.io/devcontainers/feature-starter/color:1": { - "version": "latest" - } -} -``` - -## Options - -| Options Id | Description | Type | Default Value | -|-----|-----|-----|-----| -| favorite | Choose your favorite color. | string | red | - - - ---- - -_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/feature-starter/blob/main/src/color/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ diff --git a/src/color/devcontainer-feature.json b/src/color/devcontainer-feature.json deleted file mode 100644 index e14e7e7..0000000 --- a/src/color/devcontainer-feature.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "My Favorite Color", - "id": "color", - "version": "1.0.3", - "description": "A feature to remind you of your favorite color", - "options": { - "favorite": { - "type": "string", - "enum": [ - "red", - "gold", - "green" - ], - "default": "red", - "description": "Choose your favorite color." - } - }, - "installsAfter": [ - "ghcr.io/devcontainers/features/common-utils" - ] -} diff --git a/src/color/install.sh b/src/color/install.sh deleted file mode 100644 index 883c25d..0000000 --- a/src/color/install.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -set -e - -echo "Activating feature 'color'" -echo "The provided favorite color is: ${FAVORITE}" - - -# The 'install.sh' entrypoint script is always executed as the root user. -# -# These following environment variables are passed in by the dev container CLI. -# These may be useful in instances where the context of the final -# remoteUser or containerUser is useful. -# For more details, see https://containers.dev/implementors/features#user-env-var -echo "The effective dev container remoteUser is '$_REMOTE_USER'" -echo "The effective dev container remoteUser's home directory is '$_REMOTE_USER_HOME'" - -echo "The effective dev container containerUser is '$_CONTAINER_USER'" -echo "The effective dev container containerUser's home directory is '$_CONTAINER_USER_HOME'" - -cat > /usr/local/bin/color \ -<< EOF -#!/bin/sh -echo "my favorite color is ${FAVORITE}" -EOF - -chmod +x /usr/local/bin/color diff --git a/test/_global/color_and_hello.sh b/test/_global/color_and_hello.sh deleted file mode 100644 index 9a08758..0000000 --- a/test/_global/color_and_hello.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# The 'test/_global' folder is a special test folder that is not tied to a single feature. -# -# This test file is executed against a running container constructed -# from the value of 'color_and_hello' in the tests/_global/scenarios.json file. -# -# The value of a scenarios element is any properties available in the 'devcontainer.json'. -# Scenarios are useful for testing specific options in a feature, or to test a combination of features. -# -# This test can be run with the following command (from the root of this repo) -# devcontainer features test --global-scenarios-only . - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -source dev-container-features-test-lib - -echo -e "The result of the 'color' command will be:\n" -color -echo -e "The result of the 'hello' command will be:\n" -hello -echo -e "\n" - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "check purple is my favorite color" bash -c "color | grep 'my favorite color is purple'" -check "check I am greeting with 'Greetings'" bash -c "hello | grep 'Greetings, $(whoami)'" - - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/_global/scenarios.json b/test/_global/scenarios.json deleted file mode 100644 index b046998..0000000 --- a/test/_global/scenarios.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "color_and_hello": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "color": { - "favorite": "purple" - }, - "hello": { - "greeting": "Greetings" - } - } - } -} \ No newline at end of file diff --git a/test/color/gold.sh b/test/color/gold.sh deleted file mode 100644 index 1aaa9aa..0000000 --- a/test/color/gold.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# This test file will be executed against one of the scenarios devcontainer.json test that -# includes the 'color' feature with "favorite": "gold" option. - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -source dev-container-features-test-lib - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "execute command" bash -c "color | grep 'my favorite color is gold'" - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/color/green.sh b/test/color/green.sh deleted file mode 100644 index 5b55388..0000000 --- a/test/color/green.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# This test file will be executed against one of the scenarios devcontainer.json test that -# includes the 'color' feature with "favorite": "green" option. - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -source dev-container-features-test-lib - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "execute command" bash -c "color | grep 'my favorite color is green'" - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/color/my_favorite_color_is_green.sh b/test/color/my_favorite_color_is_green.sh deleted file mode 100644 index 94e6295..0000000 --- a/test/color/my_favorite_color_is_green.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# This test file will be executed against after building a container with the -# 'my_favorite_color_is_green' scenario in 'test/test/color/scenarios.json'. -# -# For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md -# -# This scenario first uses the 'common-utils' Features to add a new user 'octocat'. -# It then installs the 'color' Feature with the FAVORITE option set to 'green' (the default FAVORITE value if none provided is 'red'). -# -# -# This test (as well as any of the other scenarios in 'scenarios.json') can be run with the following command: -# -# devcontainer features test \ -# --features color \ -# --skip-autogenerated \ -# /path/to/this/repo - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -# Provides the 'check' and 'reportResults' commands. -source dev-container-features-test-lib - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. -check "validate favorite color" color | grep 'my favorite color is green' - -# Report result -# If any of the checks above exited with a non-zero exit code, the test will fail. -reportResults diff --git a/test/color/scenarios.json b/test/color/scenarios.json deleted file mode 100644 index bfd7952..0000000 --- a/test/color/scenarios.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "my_favorite_color_is_green": { - "image": "mcr.microsoft.com/devcontainers/base:focal", - "features": { - "ghcr.io/devcontainers/features/common-utils:1": { - "installZsh": false, - "installOhMyZsh": false, - "upgradePackages": false, - "username": "octocat" - }, - "color": { - "favorite": "green" - } - }, - "remoteUser": "octocat" - }, - "gold": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "color": { - "favorite": "gold" - } - } - }, - "green": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "color": { - "favorite": "green" - } - } - } -} diff --git a/test/color/test.sh b/test/color/test.sh deleted file mode 100644 index bab0fa3..0000000 --- a/test/color/test.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# This test file will be executed against an auto-generated devcontainer.json that -# includes the 'color' Feature with no options. -# -# For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md -# -# Eg: -# { -# "image": "<..some-base-image...>", -# "features": { -# "color": {} -# }, -# "remoteUser": "root" -# } -# -# Thus, the value of all options will fall back to the default value in the -# Feature's 'devcontainer-feature.json'. -# For the 'color' feature, that means the default favorite color is 'red'. -# -# These scripts are run as 'root' by default. Although that can be changed -# with the '--remote-user' flag. -# -# This test can be run with the following command: -# -# devcontainer features test \ -# --features color \ -# --remote-user root \ -# --skip-scenarios \ -# --base-image mcr.microsoft.com/devcontainers/base:ubuntu \ -# /path/to/this/repo - -set -e - -# Optional: Import test library bundled with the devcontainer CLI -# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib -# Provides the 'check' and 'reportResults' commands. -source dev-container-features-test-lib - -# Feature-specific tests -# The 'check' command comes from the dev-container-features-test-lib. Syntax is... -# check