diff options
author | Kevin Stone <[email protected]> | 2019-08-11 10:44:00 -0500 |
---|---|---|
committer | XECDesign <[email protected]> | 2019-08-11 16:44:00 +0100 |
commit | 18b945ffb2ed771e7b234af30882f048c27c5e65 (patch) | |
tree | 7269e186073fe3a86e476b0916481e85a842544e /build-docker.sh | |
parent | 920e22bdc5224238881d8a87d17efa9d6f1e991c (diff) |
Moved git-hash determination to passed in build variable (#273)
Diffstat (limited to 'build-docker.sh')
-rwxr-xr-x | build-docker.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/build-docker.sh b/build-docker.sh index 3d7634d..583bf6a 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -52,6 +52,9 @@ if [ -z "${IMG_NAME}" ]; then exit 1 fi +# Ensure the Git Hash is recorded before entering the docker container +GIT_HASH=${GIT_HASH:-"$(git rev-parse HEAD)"} + CONTAINER_EXISTS=$(${DOCKER} ps -a --filter name="${CONTAINER_NAME}" -q) CONTAINER_RUNNING=$(${DOCKER} ps --filter name="${CONTAINER_NAME}" -q) if [ "${CONTAINER_RUNNING}" != "" ]; then @@ -73,6 +76,7 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM time ${DOCKER} run --rm --privileged \ --volume "${CONFIG_FILE}":/config:ro \ + -e "GIT_HASH=${GIT_HASH}" \ --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ pi-gen \ bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && @@ -83,6 +87,7 @@ else trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \ --volume "${CONFIG_FILE}":/config:ro \ + -e "GIT_HASH=${GIT_HASH}" \ pi-gen \ bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && cd /pi-gen; ./build.sh ${BUILD_OPTS} && |