harbor/tests/ldapprepare.sh
danfengliu acc027afd7 Remove deploytment of python3.6 and set dns for docker
1. Docker v20 is the default version for git action, dns should be set manually.
Python v3.8 is the default version for git action, so remove deployment for python v3.6.
2. Some of API tests would be affect by docker v20, like manifest get
message will not be triggered if there is one locally, to avoid this
impact, API tests will be tested with docker E2E image, in this image,
docker v19 is enabled.

Signed-off-by: danfengliu <danfengl@vmware.com>
2021-03-11 17:53:36 +08:00

30 lines
723 B
Bash
Executable File

#!/bin/bash
set -x
NAME=ldap_server
docker rm -f $NAME 2>/dev/null
docker run --env LDAP_ORGANISATION="Harbor." \
--env LDAP_DOMAIN="example.com" \
--env LDAP_ADMIN_PASSWORD="admin" \
--env LDAP_TLS_VERIFY_CLIENT="never" \
-p 389:389 \
-p 636:636 \
--detach --name $NAME osixia/openldap:1.1.7
sleep 5
docker cp ldap_test.ldif ldap_server:/
docker exec ldap_server ldapadd -x -D "cn=admin,dc=example,dc=com" -w admin -f /ldap_test.ldif -ZZ
docker ps
# failed and retry
for number in {1..10}
do
if [ ! $? -eq 0 ]; then
sleep 6
echo "retry in $number "
docker exec ldap_server ldapadd -x -D "cn=admin,dc=example,dc=com" -w admin -f /ldap_test.ldif -ZZ
else
exit 0
fi
done
exit 1