Push the collector docker image when sky-walking is tagged

This commit is contained in:
zhangxin 2017-04-25 23:39:49 +08:00
parent 84a39020bb
commit c762b2333c
1 changed files with 13 additions and 9 deletions

View File

@ -4,27 +4,31 @@ check_pull_is_tagged() {
if [ "${TRAVIS_TAG}" == "" ]; then
return 1
else
echo "This build was started by the tag ${TRAVIS_TAG}, push image"
return 0
fi
}
check_branch_is_master(){
if [ "${TRAVIS_BRANCH}" == "master" ]; then
return 0;
else
return 1;
check_release_tag() {
tag="${TRAVIS_TAG}"
if [[ "$tag" =~ ^v[0-9.]*-[0-9]{4}$ ]]; then
return 0;
else
echo "The provided tag ${tag} doesn't match that."
return 1;
fi
}
push_collector_image() {
push_image() {
IMAGE_VERSION=`echo ${TRAVIS_TAG:1}`
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
mvn clean package docker:build
docker push skywalking/skywalking-collector:latest
docker push skywalking/skywalking-collector:${TRAVIS_TAG}
docker push skywalking/skywalking-collector:${IMAGE_VERSION}
}
if check_pull_is_tagged && check_branch_is_master; then
push_collector_image
if check_pull_is_tagged && check_release_tag; then
push_image
echo "Push is Done!"
fi