Skip to content

Commit dc7528f

Browse files
committed
BUILD/MINOR: swagger: update generate swagger script to allow -rc1 tag
1 parent b37d0ef commit dc7528f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

generate/swagger/script.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ fi
1515
# if hash is to short take all of it (example v1.0.0-dev1)
1616
[ "${#CN_VERSION}" -gt 0 ] && [ "${#CN_VERSION}" -lt 6 ] && CN_VERSION=$(go mod edit -json | jq -c -r '.Replace | .[] | select(.Old.Path | contains("github.com/haproxytech/client-native/v3")) | .New.Version')
1717
# check if version is there, if not, use one from require
18-
[ -z "$CN_VERSION" ] && CN_VERSION=$(go mod edit -json | jq -c -r '.Require | .[] | select(.Path | contains("github.com/haproxytech/client-native/v3")) | .Version' 2>/dev/null | awk -F"-" '{print $NF}')
18+
[ -z "$CN_VERSION" ] && CN_VERSION=$(go mod edit -json | jq -c -r '.Require | .[] | select(.Path | contains("github.com/haproxytech/client-native/v3")) | .Version' 2>/dev/null)
19+
# check if version contains '-' and if it is a 12 char commit hash then use it, if not use the whole tag
20+
suffix=$(echo $CN_VERSION | awk -F"-" '{print$NF}')
21+
[ -z "${CN_VERSION##*"-"*}" ] && [ ${#suffix} -eq 12 ] && CN_VERSION=$suffix
1922
echo " ---> version of client native used: $CN_VERSION"
2023
# extract repository
2124
REPO_PATH=$(go mod edit -json | jq -r '.Replace | .[] | select(.Old.Path | contains("github.com/haproxytech/client-native/v3")) | .New.Path' 2>/dev/null | awk -F"/" '{print $2 "/" $3}') || ""

0 commit comments

Comments
 (0)