#!/bin/bash

set -e

if [ "integration" != "${SOURCE_BRANCH}" ]
then
    # A space-separated list of additional tags to place on this image.
    additionalTags=(latest)

    # Tag and push image for each additional tag
    for tag in ${additionalTags[@]}; do
        echo "Tagging {$IMAGE_NAME} as ${DOCKER_REPO}:${tag}"
        docker tag $IMAGE_NAME ${DOCKER_REPO}:${tag}

        echo "Pushing ${DOCKER_REPO}:${tag}"
        docker push ${DOCKER_REPO}:${tag}
    done
fi
