From 2464e942ec541d0773e5ad4e8134f9f731dc73e4 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Mon, 29 Sep 2025 11:27:25 -0300 Subject: [PATCH] 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. --- docs/release.md | 8 ++++---- release.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/release.md b/docs/release.md index 5cad5a08..539726e8 100644 --- a/docs/release.md +++ b/docs/release.md @@ -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, diff --git a/release.sh b/release.sh index dd3d12e5..d7cf0f83 100755 --- a/release.sh +++ b/release.sh @@ -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: --g # 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]}