diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 407b7386dffd54877a4c7f4bcc8d87c32cb7e046..56f7e67dea93febf2cd51f1f1c5e4ed7e0ada097 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,21 +46,21 @@ rights-engine-docker-build: # Default branch leaves tag empty (= latest tag) # All other branches are tagged with the escaped branch name (commit ref slug) script: - - | - if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then - tag="latest" - echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" - elif [[ -n "$CI_COMMIT_TAG" ]]; then - tag="$CI_COMMIT_TAG" - echo "Running on tag '$CI_COMMIT_TAG': tag = $tag" - else - tag="$CI_COMMIT_REF_SLUG" - echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" - fi - - image_name="$CI_REGISTRY_IMAGE:rights-engine-$tag" - - echo "Docker image name: $image_name" - - docker build --pull -t "$image_name" ./src - - docker push "$image_name" + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + tag="latest" + echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" + elif [[ -n "$CI_COMMIT_TAG" ]]; then + tag="$CI_COMMIT_TAG" + echo "Running on tag '$CI_COMMIT_TAG': tag = $tag" + else + tag="$CI_COMMIT_REF_SLUG" + echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" + fi + image_name="$CI_REGISTRY_IMAGE:rights-engine-$tag" + echo "Docker image name is: $image_name" + - docker build --pull -t "$image_name" ./src + - docker push "$image_name" pages: image: python:3.8-buster