Decrepate tests from drone ci (#5919)

This commit is to remove tests from drone CI server, and leave drone
as the build system only for harbor. Harbor system admin will remove
the webhook from harbor repo, then any pull request will not trigger
drone job.

Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
Yan 2018-09-19 16:54:15 +08:00 committed by GitHub
parent 3e76eaf1b3
commit e77a116e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,8 +23,8 @@ if [[ $DRONE_REPO != "goharbor/harbor" ]]; then
exit 1 exit 1
fi fi
# It won't package an new harbor build against tag, just pick up a build which passed CI and push to release. # It won't package an new harbor build against tag, just pick up a build which passed CI and push to release.
if [[ $DRONE_BUILD_EVENT == "tag" ]]; then if [[ $DRONE_BUILD_EVENT == "tag" || $DRONE_BUILD_EVENT == "pull_request" ]]; then
echo "We do nothing against 'tag'." echo "We do nothing against 'tag' and 'pull request'."
exit 0 exit 0
fi fi
@ -98,7 +98,7 @@ echo "--------------------------------------------------"
echo "Harbor UI version: $Harbor_UI_Version" echo "Harbor UI version: $Harbor_UI_Version"
echo "Harbor Package version: $Harbor_Package_Version" echo "Harbor Package version: $Harbor_Package_Version"
echo "Harbor Assets version: $Harbor_Assets_Version" echo "Harbor Assets version: $Harbor_Assets_Version"
echo "--------------------------------------------------" echo "--------------------------------------------------"
# GS util # GS util
function uploader { function uploader {
@ -127,7 +127,6 @@ function publishImage {
docker images docker images
} }
## --------------------------------------------- Run Test Case ---------------------------------------------
echo "--------------------------------------------------" echo "--------------------------------------------------"
echo "Running CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH" echo "Running CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH"
echo "--------------------------------------------------" echo "--------------------------------------------------"
@ -139,48 +138,11 @@ echo "--------------------------------------------------"
## ##
if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]]; then if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]]; then
if [[ $DRONE_BUILD_EVENT == "push" ]]; then if [[ $DRONE_BUILD_EVENT == "push" ]]; then
package_offline_installer package_offline_installer
upload_latest_build=true upload_latest_build=true
fi fi
fi fi
##
# Any Event(pull_request or push) on any branch will trigger test run.
##
if (echo $buildinfo | grep -q "\[Specific CI="); then
buildtype=$(echo $buildinfo | grep "\[Specific CI=")
testsuite=$(echo $buildtype | awk -F"\[Specific CI=" '{sub(/\].*/,"",$2);print $2}')
pybot -v HARBOR_ADMIN:$HARBOR_ADMIN -v HARBOR_PASSWORD:$HARBOR_PASSWORD -v ip:$container_ip -v notaryServerEndpoint:$container_ip:4443 --removekeywords TAG:secret --suite $testsuite tests/robot-cases
elif (echo $buildinfo | grep -q "\[Full CI\]"); then
pybot -v HARBOR_ADMIN:$HARBOR_ADMIN -v HARBOR_PASSWORD:$HARBOR_PASSWORD -v ip:$container_ip -v notaryServerEndpoint:$container_ip:4443 --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
package_offline_installer
pybot -v HARBOR_ADMIN:$HARBOR_ADMIN -v HARBOR_PASSWORD:$HARBOR_PASSWORD -v ip:$container_ip -v notaryServerEndpoint:$container_ip:4443 --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-BAT
else
# default mode is BAT.
pybot -v HARBOR_ADMIN:$HARBOR_ADMIN -v HARBOR_PASSWORD:$HARBOR_PASSWORD -v ip:$container_ip -v notaryServerEndpoint:$container_ip:4443 --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-BAT
fi
# rc is used to identify test run pass or fail.
rc="$?"
echo $rc
## --------------------------------------------- Upload Harbor CI Logs -------------------------------------------
timestamp=$(date +%s)
outfile="integration_logs_"$DRONE_BUILD_NUMBER"_"$DRONE_COMMIT".tar.gz"
tar -zcvf $outfile output.xml log.html *.png package.list *container-logs.zip *.log /var/log/harbor/* /data/config/* /data/job_logs/*
if [ -f "$outfile" ]; then
uploader $outfile $harbor_logs_bucket
echo "----------------------------------------------"
echo "Download test logs:"
echo "https://storage.googleapis.com/harbor-ci-logs/$outfile"
echo "----------------------------------------------"
else
echo "No log output file to upload"
fi
## --------------------------------------------- Upload Harbor Bundle File --------------------------------------- ## --------------------------------------------- Upload Harbor Bundle File ---------------------------------------
# #
# Build storage structure: # Build storage structure:
@ -197,9 +159,9 @@ set -e
if [ $upload_build == true ] && [ $rc -eq 0 ]; then if [ $upload_build == true ] && [ $rc -eq 0 ]; then
cp $harbor_build_bundle harbor-offline-installer-latest.tgz cp $harbor_build_bundle harbor-offline-installer-latest.tgz
uploader $harbor_build_bundle $harbor_target_bucket uploader $harbor_build_bundle $harbor_target_bucket
uploader harbor-offline-installer-latest.tgz $harbor_target_bucket uploader harbor-offline-installer-latest.tgz $harbor_target_bucket
upload_bundle_success=true upload_bundle_success=true
publishImage publishImage
fi fi
## --------------------------------------------- Upload Harbor Latest Build File ---------------------------------- ## --------------------------------------------- Upload Harbor Latest Build File ----------------------------------
@ -208,7 +170,7 @@ fi
# #
if [ $upload_latest_build == true ] && [ $upload_bundle_success == true ] && [ $rc -eq 0 ]; then if [ $upload_latest_build == true ] && [ $upload_bundle_success == true ] && [ $rc -eq 0 ]; then
echo 'https://storage.googleapis.com/'$harbor_target_bucket/$harbor_build_bundle > $latest_build_file echo 'https://storage.googleapis.com/'$harbor_target_bucket/$harbor_build_bundle > $latest_build_file
uploader $latest_build_file $harbor_target_bucket uploader $latest_build_file $harbor_target_bucket
fi fi
## --------------------------------------------- Upload securego results ------------------------------------------ ## --------------------------------------------- Upload securego results ------------------------------------------
@ -226,4 +188,3 @@ if [ -f "$keyfile" ]; then
rm -f $keyfile rm -f $keyfile
fi fi
exit $rc