Use plain repo tags for build version
This commit is contained in:
@@ -46,8 +46,6 @@ func TestRunUnknownCommand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRunVersion(t *testing.T) {
|
func TestRunVersion(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
old := Version
|
old := Version
|
||||||
Version = "test-version"
|
Version = "test-version"
|
||||||
t.Cleanup(func() { Version = old })
|
t.Cleanup(func() { Version = old })
|
||||||
@@ -63,8 +61,6 @@ func TestRunVersion(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildLabelUsesVersionAsIs(t *testing.T) {
|
func TestBuildLabelUsesVersionAsIs(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
old := Version
|
old := Version
|
||||||
Version = "1.2.3"
|
Version = "1.2.3"
|
||||||
t.Cleanup(func() { Version = old })
|
t.Cleanup(func() { Version = old })
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
tag="$(git describe --tags --match 'audit/v*' --abbrev=7 --dirty 2>/dev/null || true)"
|
|
||||||
if [ -z "${tag}" ]; then
|
|
||||||
tag="$(git describe --tags --match 'v[0-9]*' --abbrev=7 --dirty 2>/dev/null || true)"
|
tag="$(git describe --tags --match 'v[0-9]*' --abbrev=7 --dirty 2>/dev/null || true)"
|
||||||
fi
|
|
||||||
|
|
||||||
case "${tag}" in
|
case "${tag}" in
|
||||||
audit/v*)
|
|
||||||
printf '%s\n' "${tag#audit/v}"
|
|
||||||
;;
|
|
||||||
v*)
|
v*)
|
||||||
printf '%s\n' "${tag#v}"
|
printf '%s\n' "${tag#v}"
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -54,15 +54,8 @@ resolve_audit_version() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tag="$(git -C "${REPO_ROOT}" describe --tags --match 'audit/v*' --abbrev=7 --dirty 2>/dev/null || true)"
|
|
||||||
if [ -z "${tag}" ]; then
|
|
||||||
tag="$(git -C "${REPO_ROOT}" describe --tags --match 'v[0-9]*' --abbrev=7 --dirty 2>/dev/null || true)"
|
tag="$(git -C "${REPO_ROOT}" describe --tags --match 'v[0-9]*' --abbrev=7 --dirty 2>/dev/null || true)"
|
||||||
fi
|
|
||||||
case "${tag}" in
|
case "${tag}" in
|
||||||
audit/v*)
|
|
||||||
echo "${tag#audit/v}"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
v*)
|
v*)
|
||||||
echo "${tag#v}"
|
echo "${tag#v}"
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user