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