summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
Diffstat (limited to '.gitlab')
-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