diff options
author | cyBerta <cyberta@riseup.net> | 2017-10-03 10:57:53 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2017-10-11 18:45:02 +0200 |
commit | ca6a6bab5412dd13ab19f7043f320efe14a72dbd (patch) | |
tree | affd52c4a501e3d6ce9f56e3c664d940a0d63387 /.gitlab/build.sh | |
parent | adc6f7672c380d534fc963d868fe5aebcab54b4a (diff) |
8755 redirect logs during docker image creation to an artifact file
Diffstat (limited to '.gitlab/build.sh')
-rwxr-xr-x | .gitlab/build.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/.gitlab/build.sh b/.gitlab/build.sh index cc63075d..6f989001 100755 --- a/.gitlab/build.sh +++ b/.gitlab/build.sh @@ -17,8 +17,13 @@ TAG=${2:-latest} DOCKERFILE=docker/${DIR}/${2:-Dockerfile}${2:+.dockerfile} TARGET=${CI_REGISTRY_IMAGE}/${DIR}:${TAG} +function quit { + echo "Image build failed. Exit value: $?." + exit 1 +} + if git diff "$LAST_COMMIT" HEAD --name-only | egrep "($DOCKERFILE|^.gitlab)"; then - docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY" - docker build -t "$TARGET" -f "$DOCKERFILE" docker/ - docker push "$TARGET" + docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY" || quit + docker build -t "$TARGET" -f "$DOCKERFILE" docker/ || quit + docker push "$TARGET" || quit fi |