rawfile-localpv/.ci/common
2020-08-14 20:11:07 +04:30

27 lines
634 B
Bash

#!/bin/bash
set -ex
slugify() {
echo "$1" | sed -r 's/[^.a-zA-Z0-9]+/-/g'
}
export IMAGE="openebs/rawfile-localpv"
export COMMIT=$(git rev-parse --short HEAD)
export BRANCH=${TRAVIS_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}
export BRANCH_SLUG=$(slugify $BRANCH)
export CI_REGISTRY="docker.io"
export CI_TAG="${COMMIT}-ci"
export CI_IMAGE_REPO="${CI_REGISTRY}/${IMAGE}"
export CI_IMAGE_URI="${CI_IMAGE_REPO}:${CI_TAG}"
function TagAndPushImage() {
REPO="$1"
TAG="$2"
IMAGE_URI="${REPO}:${TAG}${TAG_SUFFIX}";
sudo docker tag ${CI_IMAGE_URI} ${IMAGE_URI};
echo " push ${IMAGE_URI}";
sudo docker push ${IMAGE_URI};
}