mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-10 10:32:56 +01:00
Only build/tag/push images once
Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
cc680155e8
commit
611204c382
4 changed files with 73 additions and 8 deletions
|
|
@ -6,13 +6,16 @@ stages:
|
|||
- automation
|
||||
|
||||
services:
|
||||
- docker:dind
|
||||
- docker:19.03.0-dind
|
||||
|
||||
variables:
|
||||
DOCKER_DRIVER: overlay
|
||||
DOCKER_DRIVER: overlay2
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
FORCE_BUILD: "false"
|
||||
|
||||
before_script:
|
||||
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
|
||||
- source scripts/build-helpers.sh
|
||||
|
||||
.test_build: &test_build
|
||||
stage: test
|
||||
|
|
@ -23,6 +26,8 @@ before_script:
|
|||
- docker build -f "Dockerfile.$1" .
|
||||
except:
|
||||
- master
|
||||
tags:
|
||||
- docker
|
||||
|
||||
.build_and_deploy: &build_and_deploy
|
||||
stage: build
|
||||
|
|
@ -31,6 +36,8 @@ before_script:
|
|||
- docker push "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
||||
only:
|
||||
- master
|
||||
tags:
|
||||
- docker
|
||||
|
||||
.test_custom: &test_custom
|
||||
stage: test
|
||||
|
|
@ -41,14 +48,18 @@ before_script:
|
|||
- ./scripts/custom-docker-build $1
|
||||
except:
|
||||
- master
|
||||
tags:
|
||||
- docker
|
||||
|
||||
.build_and_deploy_custom: &build_and_deploy_custom
|
||||
stage: build
|
||||
script:
|
||||
- ./scripts/custom-docker-build $CI_JOB_NAME -t "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
||||
- docker push "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
||||
- push_if_needed "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
||||
only:
|
||||
- master
|
||||
tags:
|
||||
- docker
|
||||
|
||||
# Tests
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue