diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 24c05c0..f83e92c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,8 +31,6 @@ variables: # See https://github.com/docker-library/docker/pull/166 DOCKER_TLS_CERTDIR: "/certs" - - make_image: stage: build needs: @@ -42,7 +40,6 @@ make_image: - docker:26.1.3-dind before_script: - - unset DOCKER_HOST - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: @@ -72,6 +69,8 @@ Push latest: # We do not need GitLab to clone the source code. GIT_STRATEGY: none stage: push + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: # Because we have no guarantee that this job will be picked up by the same runner # that built the image in the previous step, we pull it again locally @@ -88,6 +87,8 @@ Push commit: # Again, we do not need the source code here. Just playing with Docker. GIT_STRATEGY: none stage: push + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME @@ -101,6 +102,8 @@ Push tag: only: # We want this job to be run on tags only. - tags + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG