summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml12
1 files changed, 9 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d6250e43..70de33b5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -167,12 +167,18 @@ build_docker_image:
python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")
script:
- >
- if git diff $LAST_COMMIT HEAD --name-only|grep tests/docker; then
+ if git diff $LAST_COMMIT HEAD --name-only | egrep '(tests/docker|.gitlab)'; then
+ if [ "$CI_COMMIT_REF_SLUG" == "master" ]
+ then
+ TAG='latest'
+ else
+ TAG="$CI_COMMIT_REF_SLUG"
+ fi
docker --version
docker info
docker login -u gitlab-ci-token -e sysdev@leap.se -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t ${CI_REGISTRY_IMAGE}:latest tests/docker
- docker push ${CI_REGISTRY_IMAGE}:latest
+ docker build -t ${CI_REGISTRY_IMAGE}:${TAG} tests/docker
+ docker push ${CI_REGISTRY_IMAGE}:${TAG}
fi
.job_template: &job_definition