Merge pull request #3375 from wy65701436/removetrigger-vic-ci

add a latest.build file to index the latest harbor build
This commit is contained in:
Yan 2017-10-16 10:52:15 +08:00 committed by GitHub
commit 8583754c11

View File

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