2018-09-19 11:49:43 +02:00
|
|
|
#!/bin/bash
|
2019-11-28 12:57:49 +01:00
|
|
|
set -x
|
2018-09-19 11:49:43 +02:00
|
|
|
|
2018-09-27 09:11:20 +02:00
|
|
|
#source gskey.sh
|
2018-09-27 02:54:56 +02:00
|
|
|
|
2018-10-10 11:18:10 +02:00
|
|
|
sudo gsutil version -l
|
2018-09-27 02:54:56 +02:00
|
|
|
|
2018-10-10 11:18:10 +02:00
|
|
|
harbor_logs_bucket="harbor-ci-logs"
|
2021-11-05 08:59:35 +01:00
|
|
|
|
2019-12-11 12:11:20 +01:00
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
2022-01-19 11:26:09 +01:00
|
|
|
E2E_IMAGE="goharbor/harbor-e2e-engine:4.2.0-api"
|
2018-09-27 02:54:56 +02:00
|
|
|
|
|
|
|
# GS util
|
2018-10-10 11:18:10 +02:00
|
|
|
function uploader {
|
|
|
|
sudo gsutil cp $1 gs://$2/$1
|
2018-10-31 06:13:31 +01:00
|
|
|
sudo gsutil acl ch -u AllUsers:R gs://$2/$1
|
2018-10-10 11:18:10 +02:00
|
|
|
}
|
2018-09-27 02:54:56 +02:00
|
|
|
|
2018-10-10 11:18:10 +02:00
|
|
|
set +e
|
2018-09-19 11:49:43 +02:00
|
|
|
|
|
|
|
docker ps
|
|
|
|
# run db auth api cases
|
|
|
|
if [ "$1" = 'DB' ]; then
|
2022-01-12 08:40:21 +01:00
|
|
|
docker run -i --privileged -v $DIR/../../:/drone -v $DIR/../:/ca -w /drone $E2E_IMAGE robot --exclude proxy_cache -v DOCKER_USER:${DOCKER_USER} -v DOCKER_PWD:${DOCKER_PWD} -v ip:$2 -v ip1: -v http_get_ca:false -v HARBOR_PASSWORD:Harbor12345 /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot
|
2020-12-04 11:27:59 +01:00
|
|
|
elif [ "$1" = 'PROXY_CACHE' ]; then
|
2021-03-17 15:33:02 +01:00
|
|
|
docker run -i --privileged -v $DIR/../../:/drone -v $DIR/../:/ca -w /drone $E2E_IMAGE robot --include setup --include proxy_cache -v DOCKER_USER:${DOCKER_USER} -v DOCKER_PWD:${DOCKER_PWD} -v ip:$2 -v ip1: -v http_get_ca:false -v HARBOR_PASSWORD:Harbor12345 /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot
|
2018-11-19 06:11:44 +01:00
|
|
|
elif [ "$1" = 'LDAP' ]; then
|
|
|
|
# run ldap api cases
|
2019-12-11 12:11:20 +01:00
|
|
|
python $DIR/../../tests/configharbor.py -H $IP -u $HARBOR_ADMIN -p $HARBOR_ADMIN_PASSWD -c auth_mode=ldap_auth \
|
2019-01-09 10:40:27 +01:00
|
|
|
ldap_url=ldap://$IP \
|
|
|
|
ldap_search_dn=cn=admin,dc=example,dc=com \
|
|
|
|
ldap_search_password=admin \
|
|
|
|
ldap_base_dn=dc=example,dc=com \
|
|
|
|
ldap_uid=cn
|
2021-03-17 15:33:02 +01:00
|
|
|
docker run -i --privileged -v $DIR/../../:/drone -v $DIR/../:/ca -w /drone $E2E_IMAGE robot -v DOCKER_USER:${DOCKER_USER} -v DOCKER_PWD:${DOCKER_PWD} -v ip:$2 -v ip1: -v http_get_ca:false -v HARBOR_PASSWORD:Harbor12345 /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_LDAP.robot
|
2018-11-19 06:11:44 +01:00
|
|
|
else
|
|
|
|
rc=999
|
2018-09-19 11:49:43 +02:00
|
|
|
fi
|
2018-10-10 11:18:10 +02:00
|
|
|
rc=$?
|
2018-09-27 02:54:56 +02:00
|
|
|
## --------------------------------------------- Upload Harbor CI Logs -------------------------------------------
|
2018-10-31 06:13:31 +01:00
|
|
|
timestamp=$(date +%s)
|
2021-11-05 08:59:35 +01:00
|
|
|
GIT_COMMIT=$(git rev-parse --short "$GITHUB_SHA")
|
|
|
|
outfile="integration_logs_$timestamp$GIT_COMMIT.tar.gz"
|
2018-10-10 11:18:10 +02:00
|
|
|
sudo tar -zcvf $outfile output.xml log.html /var/log/harbor/*
|
|
|
|
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
|
2018-09-27 02:54:56 +02:00
|
|
|
|
2018-10-31 06:13:31 +01:00
|
|
|
exit $rc
|