diff options
author | eitsupi <50911393+eitsupi@users.noreply.github.com> | 2022-12-27 16:25:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-27 16:25:33 +0300 |
commit | b6921f9b9f594b6674b25189eee41783e6c6f22e (patch) | |
tree | 7f67ced3d778c2102788174f1f83e9191bda2ff3 | |
parent | b9bfe406d211ce5645a165a73b72048e9ea9e88e (diff) |
feat(common-utils): Support the new path of `meta.env` file and the new field for saving source revisions (#359)
* support the new path of meta.env
* support the new field for the image revision
* minor formatting
-rwxr-xr-x | src/common-utils/bin/devcontainer-info | 10 | ||||
-rw-r--r-- | src/common-utils/main.sh | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/common-utils/bin/devcontainer-info b/src/common-utils/bin/devcontainer-info index 2c74fea..abbb682 100755 --- a/src/common-utils/bin/devcontainer-info +++ b/src/common-utils/bin/devcontainer-info @@ -1,5 +1,12 @@ #!/bin/sh -. /usr/local/etc/vscode-dev-containers/meta.env + +# 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 @@ -22,6 +29,7 @@ if [ ! -z "${DEFINITION_ID}" ]; then echo "- Definition ID: ${DEFINITION_ID}"; f 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 diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index f0fedcf..6b1df8a 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -477,7 +477,7 @@ if [ "${ADJUSTED_ID}" = "debian" ]; then fi # Persist image metadata info, script if meta.env found in same directory -if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ]; then +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 fi |