From e9aece863c86317a39d7840805ffda84a915cbac Mon Sep 17 00:00:00 2001 From: wangyan Date: Thu, 26 Oct 2017 01:16:34 -0700 Subject: [PATCH] Add a upload build flag in Drone CI --- tests/integration.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/integration.sh b/tests/integration.sh index b7e13bd81..cd47c79a5 100755 --- a/tests/integration.sh +++ b/tests/integration.sh @@ -57,19 +57,25 @@ if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRAN echo "Package Harbor build." pybot --removekeywords TAG:secret --include Bundle tests/robot-cases/Group0-Distro-Harbor echo "Running full CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH" - pybot -v ip:$container_ip --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-BAT upload_latest_build=true + pybot -v ip:$container_ip --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-BAT elif (echo $buildinfo | grep -q "\[Specific CI="); then buildtype=$(echo $buildinfo | grep "\[Specific CI=") testsuite=$(echo $buildtype | awk -v FS="(=|])" '{print $2}') pybot -v ip:$container_ip --removekeywords TAG:secret --suite $testsuite --suite Regression tests/robot-cases elif (echo $buildinfo | grep -q "\[Full CI\]"); then - upload_build=true pybot -v ip:$container_ip --removekeywords TAG:secret --exclude skip tests/robot-cases elif (echo $buildinfo | grep -q "\[Skip CI\]"); then echo "Skip CI." +elif (echo $buildinfo | grep -q "\[Upload Build\]"); then + upload_latest_build=true + upload_build=true + echo "Package Harbor build." + pybot --removekeywords TAG:secret --include Bundle tests/robot-cases/Group0-Distro-Harbor + echo "Running full CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH" + pybot -v ip:$container_ip --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-BAT else - # default mode is BAT. + # default mode is BAT. pybot -v ip:$container_ip --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-BAT fi @@ -90,6 +96,13 @@ else echo "No log output file to upload" fi +## --------------------------------------------- Upload Harbor Build File --------------------------------------- +if [ $upload_build == true ] && [ $rc -eq 0 ]; then + harbor_build_bundle=$(basename harbor-offline-installer-*.tgz) + gsutil cp $harbor_build_bundle gs://harbor-builds + gsutil -D setacl public-read gs://harbor-builds/$harbor_build_bundle &> /dev/null +fi + ## --------------------------------------------- Upload Harbor Latest Build File --------------------------------------- if [ $upload_latest_build == true ] && [ $rc -eq 0 ]; then echo "update latest build file."