Merge pull request #6363 from ulyssessouza/6157-build-from-source

Adopts 'unknown' as build revision in case git cannot retrieve it.
This commit is contained in:
Joffrey F 2018-11-26 12:57:37 -08:00 committed by GitHub
commit c32bc095f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -2,6 +2,11 @@
#
# Write the current commit sha to the file GITSHA. This file is included in
# packaging so that `docker-compose version` can include the git sha.
#
set -e
git rev-parse --short HEAD > compose/GITSHA
# sets to 'unknown' and echoes a message if the command is not successful
DOCKER_COMPOSE_GITSHA="$(git rev-parse --short HEAD)"
if [[ "${?}" != "0" ]]; then
echo "Couldn't get revision of the git repository. Setting to 'unknown' instead"
DOCKER_COMPOSE_GITSHA="unknown"
fi
echo "${DOCKER_COMPOSE_GITSHA}" > compose/GITSHA