fix the uri of latest build file.

This commit is contained in:
wang yan 2017-10-16 14:38:54 +08:00
parent fc49245188
commit 24a80ea324

View File

@ -59,10 +59,6 @@ if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRAN
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 upload_latest_build=true
elif [ $DRONE_BRANCH == "master" ]; then
echo "Package Harbor build."
pybot --removekeywords TAG:secret --include Bundle tests/robot-cases/Group0-Distro-Harbor
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}')
@ -96,16 +92,16 @@ fi
## --------------------------------------------- Upload Harbor Latest Build File --------------------------------------- ## --------------------------------------------- Upload Harbor Latest Build File ---------------------------------------
if [ $upload_latest_build == true ] && [ $rc -eq 0 ]; then if [ $upload_latest_build == true ] && [ $rc -eq 0 ]; then
echo "update latest build file.." echo "update latest build file."
harbor_build_bundle=$(basename harbor-offline-installer-*.tgz) harbor_build_bundle=$(basename harbor-offline-installer-*.tgz)
echo $harbor_build_bundle echo $harbor_build_bundle
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
echo 'https://storage.googleapis.com/harbor-builds/$harbor_build_bundle' > $latest_build_file echo 'https://storage.googleapis.com/harbor-builds/'$harbor_build_bundle > $latest_build_file
gsutil cp $latest_build_file gs://harbor-builds gsutil cp $latest_build_file gs://harbor-builds
gsutil -D setacl public-read gs://harbor-builds/$latest_build_file &> /dev/null gsutil -D setacl public-read gs://harbor-builds/$latest_build_file &> /dev/null
fi fi
if [[ $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]] && [[ $DRONE_BUILD_EVENT == "push" || $DRONE_BUILD_EVENT == "tag" ]]; then 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 echo 'https://storage.googleapis.com/harbor-releases/'$harbor_build_bundle > $latest_build_file
gsutil cp $latest_build_file gs://harbor-releases gsutil cp $latest_build_file gs://harbor-releases
gsutil -D setacl public-read gs://harbor-releases/$latest_build_file &> /dev/null gsutil -D setacl public-read gs://harbor-releases/$latest_build_file &> /dev/null
fi fi