Setup CI: Build, run e2e tests, and push images to docker hub

This commit is contained in:
Mehran Kholdi
2020-06-19 22:08:55 +04:30
parent 16f92da467
commit ab407f3349
11 changed files with 123 additions and 21 deletions

21
.ci/common Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -ex
export IMAGE="openebs/rawfile-localpv"
export COMMIT=$(git rev-parse --short HEAD)
export BRANCH=${TRAVIS_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}
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};
}