Skip to content

Commit 91aad05

Browse files
committed
feat(ci): set daemon version from git metadata
1 parent 5a8de7b commit 91aad05

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,19 @@ RUN <<EOR
2929
set -eu
3030

3131
##
32-
# Converts the output of `git describe` to a valid python version (PEP 440)
33-
#
34-
# Examples:
35-
# - v0.4.9.2 -> 0.4.9.2
36-
# - ver0.4.8.11-3-123-g030686f -> 0.4.8.11.3.123.dev3172463
37-
#
38-
# References:
39-
# - https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers
32+
# Converts the output of `git describe` to a valid python version (PEP 440),
33+
# e.g. `v0.4.9.2` to `0.4.9.2` or `ver0.4.8.11-3-123-g030686f` to `0.4.8.11.3.123.dev3172463`
4034
##
4135
convert_git_description_to_python_version() {
4236
description="${1}"
43-
37+
hash="${description##*-g}"
4438
version="$(printf %s "${description%-g*}" | tr -c -s [0-9.] .)"
4539
version="${version#.}"
4640
version="${version%.}"
47-
hash="${description##*-g}"
4841
if [ "${hash}" != "${description}" ]; then
4942
version="${version}.dev$(printf %d "0x${hash}")"
5043
fi
51-
echo "${version}"
44+
printf '%s\n' "${version}"
5245
}
5346
if [ -z "${DAEMON_VERSION-}" ] && [ "${GIT_DESCRIPTION-}" ]; then
5447
DAEMON_VERSION="$(convert_git_description_to_python_version "${GIT_DESCRIPTION}")"

0 commit comments

Comments
 (0)