diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d6fd1fd6c7..b91817e627 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ default: when: - runner_system_failure - unknown_failure - - api_failure + - api_failure interruptible: true tags: - linux-docker @@ -240,7 +240,14 @@ build-nightly: elif [[ "${CI_COMMIT_REF_NAME}" ]]; then VERSION=$(echo ${CI_COMMIT_REF_NAME} | sed -r 's#/+#-#g'); fi - - echo "Effective tags = ${VERSION} sha-${CI_COMMIT_SHORT_SHA} latest" + # When building from version tags (v1.0, v2.1rc1, ...) we'll use "production" to tag + # docker image. In all other cases, it'll be "latest". + - if [[ $CI_COMMIT_REF_NAME =~ ^v[0-9]+\.[0-9]+.*$ ]]; then + FLOATING_TAG="production"; + else + FLOATING_TAG="latest"; + fi + - echo "Effective tags = ${VERSION} sha-${CI_COMMIT_SHORT_SHA} ${FLOATING_TAG}" secrets: DOCKER_HUB_USER: vault: cicd/gitlab/parity/DOCKER_HUB_USER@kv @@ -260,7 +267,7 @@ build-nightly: --build-arg VERSION="${VERSION}" --tag "${IMAGE_NAME}:${VERSION}" --tag "${IMAGE_NAME}:sha-${CI_COMMIT_SHORT_SHA}" - --tag "${IMAGE_NAME}:latest" + --tag "${IMAGE_NAME}:${FLOATING_TAG}" --file "${DOCKERFILE}" . # The job will success only on the protected branch - echo "${DOCKER_HUB_PASS}" | @@ -268,7 +275,7 @@ build-nightly: - buildah info - buildah push --format=v2s2 "${IMAGE_NAME}:${VERSION}" - buildah push --format=v2s2 "${IMAGE_NAME}:sha-${CI_COMMIT_SHORT_SHA}" - - buildah push --format=v2s2 "${IMAGE_NAME}:latest" + - buildah push --format=v2s2 "${IMAGE_NAME}:${FLOATING_TAG}" after_script: - env REGISTRY_AUTH_FILE= buildah logout --all