-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[features test cmd] Respect image label metadata (#288)
* respect experimentalImageMetadata labels in the devcontainer feature test cmd * type-check * update existing tests to support image metadata * remove unused feature * flip condition and rename to --skip-image-metadata * update tests
- Loading branch information
1 parent
add354f
commit 790aa75
Showing
21 changed files
with
222 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...atures/example-v2-features-sets/autogenerated-set-flags/src/hey/devcontainer-feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"id": "hey", | ||
"version": "0.0.16", | ||
"name": "A hey world feature", | ||
"options": { | ||
"greeting": { | ||
"type": "string", | ||
"default": "Good day", | ||
"description": "Select a pre-made greeting, or enter your own" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...st/container-features/example-v2-features-sets/autogenerated-set-flags/src/hey/install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo "Activating feature 'localFeatureA'" | ||
|
||
GREETING=${GREETING:-undefined} | ||
echo "The provided greeting is: $GREETING" | ||
|
||
cat > /usr/local/bin/hello \ | ||
<< EOF | ||
#!/bin/sh | ||
RED='\033[0;91m' | ||
NC='\033[0m' # No Color | ||
echo "\${RED}${GREETING}, \$(whoami)\${NC}" | ||
EOF | ||
|
||
chmod +x /usr/local/bin/hello |
16 changes: 16 additions & 0 deletions
16
...test/container-features/example-v2-features-sets/autogenerated-set-flags/test/hey/test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Optional: Import test library | ||
source dev-container-features-test-lib | ||
|
||
# Definition specific tests | ||
check "runHelloCmd" hello | ||
|
||
# Passed in by --remote-user flag, that overrides the base image's user of 'vscode' | ||
# The 'simple' feature set tests the opposite. | ||
check "ensure i am user root" bash -c "whoami | grep 'root'" | ||
|
||
# Report result | ||
reportResults |
15 changes: 0 additions & 15 deletions
15
...eatures/example-v2-features-sets/not-root-remote-user/test/whoisremoteuser/scenarios.json
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...emote-user/src/whoisremoteuser/install.sh → ...emote-user/src/whoisremoteuser/install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...features-sets/remote-user/test/whoisremoteuser/from_image_metadata_label_flag_disabled.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Optional: Import test library | ||
source dev-container-features-test-lib | ||
|
||
check "ensure i am user root" bash -c "whoami | grep 'root'" | ||
|
||
check "_REMOTE_USER was equal to root" bash -c "whoisremoteuser | grep 'root'" | ||
|
||
# Report result | ||
reportResults |
13 changes: 13 additions & 0 deletions
13
...-features-sets/remote-user/test/whoisremoteuser/from_image_metadata_label_flag_enabled.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Optional: Import test library | ||
source dev-container-features-test-lib | ||
|
||
check "ensure i am user node" bash -c "whoami | grep 'node'" | ||
|
||
check "_REMOTE_USER was equal to node" bash -c "whoisremoteuser | grep 'node'" | ||
|
||
# Report result | ||
reportResults |
27 changes: 27 additions & 0 deletions
27
...ntainer-features/example-v2-features-sets/remote-user/test/whoisremoteuser/scenarios.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"add_with_common_utils": { | ||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu", | ||
"remoteUser": "codespace", | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:1": { | ||
"installZsh": false, | ||
"installOhMyZsh": false, | ||
"upgradePackages": false, | ||
"username": "codespace" | ||
}, | ||
"whoisremoteuser": {} | ||
} | ||
}, | ||
"from_image_metadata_label_flag_enabled": { | ||
"image": "mcr.microsoft.com/devcontainers/javascript-node:18", | ||
"features": { | ||
"whoisremoteuser": {} | ||
} | ||
}, | ||
"from_image_metadata_label_flag_disabled": { | ||
"image": "mcr.microsoft.com/devcontainers/javascript-node:18", | ||
"features": { | ||
"whoisremoteuser": {} | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/test/container-features/example-v2-features-sets/simple/test/color/scenarios.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.