# Push Images Template
.push:
    script:
        - echo "$HARBOR_PASSWORD" | docker login -u "$HARBOR_USER" --password-stdin $REGISTRY_URL
        - NAME="${REGISTRY_URL}/${PROJECT_NAME}/${SERVICE_NAME}"
        - docker push ${NAME}:${CI_COMMIT_SHORT_SHA}
        - docker push ${NAME}:${IMAGE_TAG}
    rules:
        - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
          variables:
            IMAGE_TAG: $CI_DEFAULT_BRANCH
        - if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/'
          variables:
            IMAGE_TAG: $CI_COMMIT_TAG
        - if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/'
          variables:
            IMAGE_TAG: $CI_COMMIT_TAG
    dependencies: []
