summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorVarac <varac@leap.se>2017-12-28 13:09:32 +0100
committerVarac <varac@leap.se>2017-12-28 13:14:27 +0100
commit36d365ffc5969c639db8a7833d2e29c77057a2ea (patch)
treeb31488174c4de24b32442b2258c95689fc23d0cf /.gitlab-ci.yml
parenta48e2f8521025b0992e87245cb02a90a5fc74e58 (diff)
[CI] Tag images according to git branch name
Diffstat (limited to '.gitlab-ci.yml')
-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