mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-21 17:55:30 +01:00
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:
parent
3e76eaf1b3
commit
e77a116e1d
@ -23,8 +23,8 @@ if [[ $DRONE_REPO != "goharbor/harbor" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
# 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
|
||||
echo "We do nothing against 'tag'."
|
||||
if [[ $DRONE_BUILD_EVENT == "tag" || $DRONE_BUILD_EVENT == "pull_request" ]]; then
|
||||
echo "We do nothing against 'tag' and 'pull request'."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -98,7 +98,7 @@ echo "--------------------------------------------------"
|
||||
echo "Harbor UI version: $Harbor_UI_Version"
|
||||
echo "Harbor Package version: $Harbor_Package_Version"
|
||||
echo "Harbor Assets version: $Harbor_Assets_Version"
|
||||
echo "--------------------------------------------------"
|
||||
echo "--------------------------------------------------"
|
||||
|
||||
# GS util
|
||||
function uploader {
|
||||
@ -127,7 +127,6 @@ function publishImage {
|
||||
docker images
|
||||
}
|
||||
|
||||
## --------------------------------------------- Run Test Case ---------------------------------------------
|
||||
echo "--------------------------------------------------"
|
||||
echo "Running CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH"
|
||||
echo "--------------------------------------------------"
|
||||
@ -139,48 +138,11 @@ echo "--------------------------------------------------"
|
||||
##
|
||||
if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]]; then
|
||||
if [[ $DRONE_BUILD_EVENT == "push" ]]; then
|
||||
package_offline_installer
|
||||
upload_latest_build=true
|
||||
package_offline_installer
|
||||
upload_latest_build=true
|
||||
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 ---------------------------------------
|
||||
#
|
||||
# Build storage structure:
|
||||
@ -197,9 +159,9 @@ set -e
|
||||
if [ $upload_build == true ] && [ $rc -eq 0 ]; then
|
||||
cp $harbor_build_bundle harbor-offline-installer-latest.tgz
|
||||
uploader $harbor_build_bundle $harbor_target_bucket
|
||||
uploader harbor-offline-installer-latest.tgz $harbor_target_bucket
|
||||
upload_bundle_success=true
|
||||
publishImage
|
||||
uploader harbor-offline-installer-latest.tgz $harbor_target_bucket
|
||||
upload_bundle_success=true
|
||||
publishImage
|
||||
fi
|
||||
|
||||
## --------------------------------------------- Upload Harbor Latest Build File ----------------------------------
|
||||
@ -208,7 +170,7 @@ fi
|
||||
#
|
||||
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
|
||||
uploader $latest_build_file $harbor_target_bucket
|
||||
uploader $latest_build_file $harbor_target_bucket
|
||||
fi
|
||||
|
||||
## --------------------------------------------- Upload securego results ------------------------------------------
|
||||
@ -226,4 +188,3 @@ if [ -f "$keyfile" ]; then
|
||||
rm -f $keyfile
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
|
Loading…
Reference in New Issue
Block a user