Skip to content

Commit 3dfe40e

Browse files
committed
fix: derive DEEPOPS_VERSION for script debug output
scripts/common.sh printed an always-empty DEEPOPS_VERSION unless a user happened to set it in config/env.sh. Default it to the checkout's git tag description (git describe --tags --always) with an unknown fallback, keep the env.sh override, and document the variable in config.example/env.sh.
1 parent 01b332f commit 3dfe40e

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

config.example/env.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
# See deepops/scripts/common.sh for implementation details
55

66
DEEPOPS_EXAMPLE_VAR=""
7+
8+
# DeepOps version reported in script debug output.
9+
# Defaults to the checkout's git tag description; uncomment to override.
10+
# DEEPOPS_VERSION=""

scripts/common.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,11 @@ else
1919
source ${DEEPOPS_CONFIG_DIR}/env.sh
2020
fi
2121

22+
# Determine the DeepOps version for debug output.
23+
# Can be overridden in config/env.sh; defaults to the checkout's git tag description.
24+
if [ -z "${DEEPOPS_VERSION}" ]; then
25+
DEEPOPS_VERSION="$(git -C "${ROOT_DIR}" describe --tags --always 2>/dev/null || echo unknown)"
26+
fi
27+
2228
# Print out base debug
2329
echo "Starting '${0}'; DeepOps version '${DEEPOPS_VERSION}'"

0 commit comments

Comments
 (0)