Skip to content

Commit 2464e94

Browse files
committed
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.
1 parent 35d0fa2 commit 2464e94

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/release.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ make docker-release tag=v0.31.3-beta
2323
This will create the release artifacts in the `loop-v0.31.3-beta` directory.
2424

2525
If you want to build from an untagged commit, first check it out, then use the
26-
output of `git describe` as the tag:
26+
output of `git describe --abbrev=10` as the tag:
2727

2828
```bash
29-
git describe
30-
# v0.31.2-beta-128-gfa80357
29+
git describe --abbrev=10
30+
# v0.31.2-beta-135-g35d0fa26ac
3131

32-
make docker-release tag=v0.31.2-beta-128-gfa80357
32+
make docker-release tag=v0.31.2-beta-135-g35d0fa26ac
3333
```
3434

3535
You can filter the target platforms to speed up the build process. For example,

release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ check_tag() {
4141
TAG=$1
4242

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

0 commit comments

Comments
 (0)