release.sh: use git describe --abbrev=10

Without --abbrev flag it may produce different number of hash characters
on different instances. It depends on the state of Git repo itself.
This commit is contained in:
Boris Nagaev 2025-09-29 11:27:25 -03:00
parent 35d0fa26ac
commit 2464e942ec
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View file

@ -23,13 +23,13 @@ make docker-release tag=v0.31.3-beta
This will create the release artifacts in the `loop-v0.31.3-beta` directory.
If you want to build from an untagged commit, first check it out, then use the
output of `git describe` as the tag:
output of `git describe --abbrev=10` as the tag:
```bash
git describe
# v0.31.2-beta-128-gfa80357
git describe --abbrev=10
# v0.31.2-beta-135-g35d0fa26ac
make docker-release tag=v0.31.2-beta-128-gfa80357
make docker-release tag=v0.31.2-beta-135-g35d0fa26ac
```
You can filter the target platforms to speed up the build process. For example,

View file

@ -41,7 +41,7 @@ check_tag() {
TAG=$1
# If a tag is specified, ensure that tag is present and checked out.
if [[ $TAG != $(git describe) ]]; then
if [[ $TAG != $(git describe --abbrev=10) ]]; then
red "tag $TAG not checked out"
exit 1
fi
@ -50,7 +50,7 @@ check_tag() {
# output of "git describe" for an untagged commit, skip verification.
# The pattern is: <tag_name>-<number_of_commits>-g<abbreviated_commit_hash>
# Example: "v0.31.2-beta-122-g8c6b73c".
if [[ $TAG =~ -[0-9]+-g([0-9a-f]+)$ ]]; then
if [[ $TAG =~ -[0-9]+-g([0-9a-f]{10})$ ]]; then
# This looks like a "git describe" output. Make sure the hash
# described is a prefix of the current commit.
DESCRIBED_HASH=${BASH_REMATCH[1]}