Skip to content

Commit

Permalink
Tag: Use commit date instead of current date
Browse files Browse the repository at this point in the history
This will mean the tags will be reproducible, which will be less confusing to the users.
  • Loading branch information
torsava authored and pkubatrh committed Apr 9, 2019
1 parent 0fd64b8 commit 3144157
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ for dir in ${VERSIONS}; do
IMAGE_ID=$(cat .image-id)
name=$(docker inspect -f "{{.Config.Labels.name}}" $IMAGE_ID)
version=$(docker inspect -f "{{.Config.Labels.version}}" $IMAGE_ID)
date_and_hash="$(date +%Y%m%d)-$(git rev-parse --short HEAD)"
commit_date=$(git show -s HEAD --format=%cd --date=short | sed 's/-//g')
date_and_hash="${commit_date}-$(git rev-parse --short HEAD)"

echo "-> Tagging image '$IMAGE_ID' as '$name:$version' and '$name:latest' and '$name:$date_and_hash'"
docker tag $IMAGE_ID "$name:$version"
Expand Down

0 comments on commit 3144157

Please sign in to comment.