aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common-utils/devcontainer-feature.json2
-rw-r--r--src/common-utils/main.sh6
-rwxr-xr-xtest/common-utils/devcontainer-info.sh25
-rw-r--r--test/common-utils/devcontainer-info/Dockerfile3
-rw-r--r--test/common-utils/devcontainer-info/meta.env8
-rw-r--r--test/common-utils/scenarios.json15
6 files changed, 55 insertions, 4 deletions
diff --git a/src/common-utils/devcontainer-feature.json b/src/common-utils/devcontainer-feature.json
index 33cd19d..82623f9 100644
--- a/src/common-utils/devcontainer-feature.json
+++ b/src/common-utils/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "common-utils",
- "version": "2.0.4",
+ "version": "2.0.5",
"name": "Common Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh
index 2021485..7cc9409 100644
--- a/src/common-utils/main.sh
+++ b/src/common-utils/main.sh
@@ -474,18 +474,18 @@ fi
# code shim, it fallbacks to code-insiders if code is not available
cp -f "${FEATURE_DIR}/bin/code" /usr/local/bin/
-chmod +x /usr/local/bin/code
+chmod +rx /usr/local/bin/code
# systemctl shim for Debian/Ubuntu - tells people to use 'service' if systemd is not running
if [ "${ADJUSTED_ID}" = "debian" ]; then
cp -f "${FEATURE_DIR}/bin/systemctl" /usr/local/bin/systemctl
- chmod +x /usr/local/bin/systemctl
+ chmod +rx /usr/local/bin/systemctl
fi
# Persist image metadata info, script if meta.env found in same directory
if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ] || [ -f "/usr/local/etc/dev-containers/meta.env" ]; then
cp -f "${FEATURE_DIR}/bin/devcontainer-info" /usr/local/bin/devcontainer-info
- chmod +x /usr/local/bin/devcontainer-info
+ chmod +rx /usr/local/bin/devcontainer-info
fi
# Write marker file
diff --git a/test/common-utils/devcontainer-info.sh b/test/common-utils/devcontainer-info.sh
new file mode 100755
index 0000000..65a4a40
--- /dev/null
+++ b/test/common-utils/devcontainer-info.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+check_info() {
+ local info=$1
+ check "devcontainer-info ${info}" sh -c "devcontainer-info | grep test-${info}"
+}
+
+# Definition specific tests
+check "user" bash -c "whoami | grep vscode"
+check_info "version"
+check_info "id"
+check_info "variant"
+check_info "repository"
+check_info "release"
+check_info "revision"
+check_info "time"
+check_info "url"
+
+# Report result
+reportResults
diff --git a/test/common-utils/devcontainer-info/Dockerfile b/test/common-utils/devcontainer-info/Dockerfile
new file mode 100644
index 0000000..28247d9
--- /dev/null
+++ b/test/common-utils/devcontainer-info/Dockerfile
@@ -0,0 +1,3 @@
+FROM ubuntu:focal
+
+COPY meta.env /usr/local/etc/dev-containers/meta.env
diff --git a/test/common-utils/devcontainer-info/meta.env b/test/common-utils/devcontainer-info/meta.env
new file mode 100644
index 0000000..dfc61d3
--- /dev/null
+++ b/test/common-utils/devcontainer-info/meta.env
@@ -0,0 +1,8 @@
+VERSION='test-version'
+DEFINITION_ID='test-id'
+VARIANT='test-variant'
+GIT_REPOSITORY='test-repository'
+GIT_REPOSITORY_RELEASE='test-release'
+GIT_REPOSITORY_REVISION='test-revision'
+BUILD_TIMESTAMP='test-time'
+CONTENTS_URL='test-url'
diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json
index bc1c784..dbf9cdc 100644
--- a/test/common-utils/scenarios.json
+++ b/test/common-utils/scenarios.json
@@ -114,5 +114,20 @@
"configureZshAsDefaultShell": true
}
}
+ },
+ "devcontainer-info": {
+ "build": {
+ "dockerfile": "Dockerfile"
+ },
+ "features": {
+ "common-utils": {
+ "username": "vscode",
+ "userUid": "1000",
+ "userGid": "1000",
+ "upgradePackages": true,
+ "installZsh": true
+ }
+ },
+ "remoteUser": "vscode"
}
}