summaryrefslogtreecommitdiff
path: root/.gitlab/build.sh
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2017-10-13 13:34:39 +0000
committercyberta <cyberta@riseup.net>2017-10-13 13:34:39 +0000
commit0b146ea7ce6b628c7ff56a20318e7495960dfb7c (patch)
treeff97faa119a4b0dd180e841a8118536444df9c42 /.gitlab/build.sh
parentef91d9235cccbd4dcd9e120c8fff910e0d448022 (diff)
parentca6a6bab5412dd13ab19f7043f320efe14a72dbd (diff)
Merge branch '8755_reduce_logs_during_image_creation' into 'master'
8755 redirect logs during docker image creation to an artifact file See merge request leap/bitmask_android!12
Diffstat (limited to '.gitlab/build.sh')
-rwxr-xr-x.gitlab/build.sh11
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