From 66c1a55f98d1d4fb07ef7cd0253b90bfa130dacd Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Sat, 30 Jul 2016 09:21:01 +0300 Subject: [PATCH 1/2] Push images only on master --- .gitlab-ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f52821a..f695bac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,11 +9,29 @@ variables: before_script: - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" registry.gitlab.com +.test_build: &test_build + stage: test + script: + # Hack to set an array in /bin/sh + # http://unix.stackexchange.com/a/137571 + - set $CI_BUILD_NAME + - export JOB=$(printf '%s\n' "$1") + - docker build -f "Dockerfile.$JOB" . + except: + - master + .build_and_deploy: &build_and_deploy stage: build script: - docker build -t "$CI_REGISTRY_IMAGE:$CI_BUILD_NAME" -f "Dockerfile.$CI_BUILD_NAME" . - docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_NAME" + only: + - master + +ruby-2.1 test: *test_build +ruby-2.2 test: *test_build +ruby-2.3 test: *test_build +www-gitlab-com test: *test_build ruby-2.1: *build_and_deploy ruby-2.2: *build_and_deploy From 1124df3e46aa1689169e96676bcfce219f461263 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Fri, 5 Aug 2016 15:40:09 +0300 Subject: [PATCH 2/2] Simplify things --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f695bac..2c0d8ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,9 +14,8 @@ before_script: script: # Hack to set an array in /bin/sh # http://unix.stackexchange.com/a/137571 - - set $CI_BUILD_NAME - - export JOB=$(printf '%s\n' "$1") - - docker build -f "Dockerfile.$JOB" . + - set -- $CI_BUILD_NAME + - docker build -f "Dockerfile.$1" . except: - master