summaryrefslogtreecommitdiff
path: root/features/src/common-utils/bin/devcontainer-info
diff options
context:
space:
mode:
Diffstat (limited to 'features/src/common-utils/bin/devcontainer-info')
-rwxr-xr-xfeatures/src/common-utils/bin/devcontainer-info35
1 files changed, 35 insertions, 0 deletions
diff --git a/features/src/common-utils/bin/devcontainer-info b/features/src/common-utils/bin/devcontainer-info
new file mode 100755
index 0000000..abbb682
--- /dev/null
+++ b/features/src/common-utils/bin/devcontainer-info
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Load meta.env
+if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ]; then
+ . /usr/local/etc/vscode-dev-containers/meta.env
+fi
+if [ -f "/usr/local/etc/dev-containers/meta.env" ]; then
+ . /usr/local/etc/dev-containers/meta.env
+fi
+
+# Minimal output
+if [ "$1" = "version" ] || [ "$1" = "image-version" ]; then
+ echo "${VERSION}"
+ exit 0
+elif [ "$1" = "release" ]; then
+ echo "${GIT_REPOSITORY_RELEASE}"
+ exit 0
+elif [ "$1" = "content" ] || [ "$1" = "content-url" ] || [ "$1" = "contents" ] || [ "$1" = "contents-url" ]; then
+ echo "${CONTENTS_URL}"
+ exit 0
+fi
+
+#Full output
+echo
+echo "Development container image information"
+echo
+if [ ! -z "${VERSION}" ]; then echo "- Image version: ${VERSION}"; fi
+if [ ! -z "${DEFINITION_ID}" ]; then echo "- Definition ID: ${DEFINITION_ID}"; fi
+if [ ! -z "${VARIANT}" ]; then echo "- Variant: ${VARIANT}"; fi
+if [ ! -z "${GIT_REPOSITORY}" ]; then echo "- Source code repository: ${GIT_REPOSITORY}"; fi
+if [ ! -z "${GIT_REPOSITORY_RELEASE}" ]; then echo "- Source code release/branch: ${GIT_REPOSITORY_RELEASE}"; fi
+if [ ! -z "${GIT_REPOSITORY_REVISION}" ]; then echo "- Source code revision: ${GIT_REPOSITORY_REVISION}"; fi
+if [ ! -z "${BUILD_TIMESTAMP}" ]; then echo "- Timestamp: ${BUILD_TIMESTAMP}"; fi
+if [ ! -z "${CONTENTS_URL}" ]; then echo && echo "More info: ${CONTENTS_URL}"; fi
+echo