1
0

write-git-sha 491 B

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