diff --git a/tests/integration.sh b/tests/integration.sh index ff70361d3..b19c443e3 100755 --- a/tests/integration.sh +++ b/tests/integration.sh @@ -29,6 +29,8 @@ buildinfo=$(drone build info vmware/harbor $DRONE_BUILD_NUMBER) echo $buildinfo upload_build=false nightly_run=false +upload_latest_build=false +latest_build_file='latest.build' # GC credentials keyfile="/root/harbor-ci-logs.key" @@ -51,11 +53,12 @@ if [ $DRONE_REPO != "vmware/harbor" ]; then fi if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]] && [[ $DRONE_BUILD_EVENT == "push" || $DRONE_BUILD_EVENT == "tag" ]]; then - ## -------------- Package installer with clean code ----------------- - echo "Package Harbor build." - pybot --removekeywords TAG:secret --include Bundle tests/robot-cases/Group0-Distro-Harbor + ## -------------- Package installer with clean code ----------------- + 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 + pybot -v ip:$container_ip --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-BAT + upload_latest_build=true elif (echo $buildinfo | grep -q "\[Specific CI="); then buildtype=$(echo $buildinfo | grep "\[Specific CI=") testsuite=$(echo $buildtype | awk -v FS="(=|])" '{print $2}') @@ -87,19 +90,20 @@ else echo "No log output file to upload" fi -## --------------------------------------------- Upload Harbor Build --------------------------------------- -#if [ $upload_build == true ] && [ $rc -eq 0 ]; then -# ls -la bundle -# harbor_build=$(basename bundle/*) -# gsutil cp $harbor_build gs://harbor-builds -# echo "----------------------------------------------" -# echo "Download harbor builds:" -# echo "https://storage.googleapis.com/harbor-builds/$harbor_build" -# echo "----------------------------------------------" -# gsutil -D setacl public-read gs://harbor-builds/$harbor_build &> /dev/null -#else -# echo "No harbor build to upload" -#fi +## --------------------------------------------- Upload Harbor Latest Build File --------------------------------------- +if [ $upload_latest_build == true ] && [ $rc -eq 0 ]; then + harbor_build_bundle=$(basename harbor-offline-installer-*.tgz) + if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]] && [[ $DRONE_BUILD_EVENT == "push" || $DRONE_BUILD_EVENT == "tag" ]]; then + echo 'https://storage.googleapis.com/harbor-builds/$harbor_build_bundle' > $latest_build_file + gsutil cp $latest_build_file gs://harbor-builds + gsutil -D setacl public-read gs://harbor-builds/$latest_build_file &> /dev/null + fi + if [[ $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]] && [[ $DRONE_BUILD_EVENT == "push" || $DRONE_BUILD_EVENT == "tag" ]]; then + echo 'https://storage.googleapis.com/harbor-releases/$harbor_build_bundle' > $latest_build_file + gsutil cp $latest_build_file gs://harbor-releases + gsutil -D setacl public-read gs://harbor-releases/$latest_build_file &> /dev/null + fi +fi ## --------------------------------------------- Sendout Email --------------------------------------------- if [ $nightly_run == true ]; then