Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
bugfix: consistent version string generation
Browse files Browse the repository at this point in the history
different images have different ways to generate the version string,
leading to bugs and incorrect docker tags, etc:

$ docker run circleci/ruby:2.3 git version
git version 2.1.4
$ docker run circleci/golang:1.9.2 git version
git version 2.11.0

$ docker run circleci/golang:1.9.2 sh -c 'git clone
https://github.com/grafana/metrictank.git && cd metrictank && git
describe --always'
Cloning into 'metrictank'...
0.8.0-62-g4d1b958e

$ docker run circleci/ruby:2.3 sh -c 'cd /tmp && git clone
https://github.com/grafana/metrictank.git && cd metrictank && git
describe --always'
Cloning into 'metrictank'...
0.8.0-62-g4d1b958

With the new approach, we have consistency
  • Loading branch information
Dieterbe committed Jan 30, 2018
1 parent 4d1b958 commit 99cf721
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cd ${DIR}/..
# and https://stackoverflow.com/questions/37531605/how-to-test-if-git-repository-is-shallow
[ -f $(git rev-parse --git-dir)/shallow ] && git fetch --unshallow

GITVERSION=`git describe --always`
GITVERSION=`git describe --abbrev=7`
BUILDDIR=$(pwd)/build

# Make dir
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -x
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}

VERSION=`git describe --always`
VERSION=`git describe --abbrev=7`

# regular image
rm -rf build/*
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mkdir $BUILD_PKG
sudo apt-get install rpm # to be able to make rpms

ARCH="$(uname -m)"
VERSION=$(git describe --long --always)
VERSION=$(git describe --long --abbrev=7)


## debian wheezy ##
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}/..

GITVERSION=`git describe --always`
GITVERSION=`git describe --abbrev=7`
BUILDDIR=$(pwd)/build

# Make dir
Expand Down
2 changes: 1 addition & 1 deletion scripts/push/dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}/../..

VERSION=`git describe --always`
VERSION=`git describe --abbrev=7`

echo docker push grafana/metrictank:$VERSION
docker push grafana/metrictank:$VERSION || exit 2
Expand Down
2 changes: 1 addition & 1 deletion scripts/push/extra-qa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ log () {
echo "$(date +'%Y/%m/%d %H:%M:%S') $@"
}

VERSION=`git describe --always`
VERSION=`git describe --abbrev=7`

# try returns if did not succeed and is retryable
# exits in all other cases
Expand Down
2 changes: 1 addition & 1 deletion scripts/push/gcr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}/../..

VERSION=`git describe --always`
VERSION=`git describe --abbrev=7`

docker login -u _json_key -p "$GOOGLE_AUTH" https://us.gcr.io
echo docker push us.gcr.io/metrictank-gcr/metrictank:$VERSION
Expand Down

0 comments on commit 99cf721

Please sign in to comment.