Skip to content
Snippets Groups Projects
Commit d470dd49 authored by E. Madison Bray's avatar E. Madison Bray
Browse files

[ci][bug] use a more build-specific name for the temp Docker image

created for the build

otherwise two pipelines building the same commit (e.g. if the branch
name is ci/ and there is also a merge request) can interfere with
each other
parent 91f32cea
Branches ci/tag-master
No related tags found
1 merge request!3[ci] tag Docker images built from the master branch
Pipeline #1296 failed
......@@ -7,6 +7,7 @@ stages:
variables:
DOCKER_VERSION: 18.09.9
IMAGE_REGISTRY: renewal/recsystems-baseline
TEMP_IMAGE_TAG: ${CI_COMMIT_SHA}-${CI_BUILD_ID}
# Override the default workflow rules to only run pipelines on the master
# branch, merge requests, or branches that contain the string 'ci/'
......@@ -32,7 +33,7 @@ docker:build:
script:
- >
docker build --cache-from ${IMAGE_REGISTRY}:master
--tag ${IMAGE_REGISTRY}:${CI_COMMIT_SHA} .
--tag ${IMAGE_REGISTRY}:${TEMP_IMAGE_TAG} .
.test: &test
......@@ -120,7 +121,7 @@ test:docker:
before_script:
- docker info
script:
- docker tag ${IMAGE_REGISTRY}:${CI_COMMIT_SHA} ${REGISTRY_IMAGE}:${TAG_NAME}
- docker tag ${IMAGE_REGISTRY}:${TEMP_IMAGE_TAG} ${REGISTRY_IMAGE}:${TAG_NAME}
deploy:docker-master:
......@@ -139,5 +140,5 @@ cleanup:docker:
before_script:
- docker info
script:
- docker rmi ${IMAGE_REGISTRY}:${CI_COMMIT_SHA}
- docker rmi ${IMAGE_REGISTRY}:${TEMP_IMAGE_TAG}
- docker rmi $(docker images --filter dangling=true -q --no-trunc ${IMAGE_REGISTRY}) || true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment