Add Notary server endpoint as a parameter for the CI test cases

This commit is contained in:
wangyan 2018-07-26 19:39:16 -07:00
parent c3106fc447
commit c3c56ada9a
5 changed files with 13 additions and 12 deletions

View File

@ -150,17 +150,17 @@ fi
if (echo $buildinfo | grep -q "\[Specific CI="); then if (echo $buildinfo | grep -q "\[Specific CI="); then
buildtype=$(echo $buildinfo | grep "\[Specific CI=") buildtype=$(echo $buildinfo | grep "\[Specific CI=")
testsuite=$(echo $buildtype | awk -F"\[Specific CI=" '{sub(/\].*/,"",$2);print $2}') 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 --removekeywords TAG:secret --suite $testsuite tests/robot-cases 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 elif (echo $buildinfo | grep -q "\[Full CI\]"); then
pybot -v HARBOR_ADMIN:$HARBOR_ADMIN -v HARBOR_PASSWORD:$HARBOR_PASSWORD -v ip:$container_ip --removekeywords TAG:secret --exclude skip tests/robot-cases 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 elif (echo $buildinfo | grep -q "\[Skip CI\]"); then
echo "Skip CI." echo "Skip CI."
elif (echo $buildinfo | grep -q "\[Upload Build\]"); then elif (echo $buildinfo | grep -q "\[Upload Build\]"); then
package_offline_installer package_offline_installer
pybot -v HARBOR_ADMIN:$HARBOR_ADMIN -v HARBOR_PASSWORD:$HARBOR_PASSWORD -v ip:$container_ip --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-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
else else
# default mode is BAT. # default mode is BAT.
pybot -v HARBOR_ADMIN:$HARBOR_ADMIN -v HARBOR_PASSWORD:$HARBOR_PASSWORD -v ip:$container_ip --removekeywords TAG:secret --include BAT tests/robot-cases/Group0-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 fi
# rc is used to identify test run pass or fail. # rc is used to identify test run pass or fail.

View File

@ -102,17 +102,17 @@ Enable Notary Client
Log ${ip} Log ${ip}
${rc}= Run And Return Rc mkdir -p /etc/docker/certs.d/${ip}/ ${rc}= Run And Return Rc mkdir -p /etc/docker/certs.d/${ip}/
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc mkdir -p ~/.docker/tls/${ip}:4443/ ${rc}= Run And Return Rc mkdir -p ~/.docker/tls/${notaryServerEndpoint}/
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt /etc/docker/certs.d/${ip}/ ${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt /etc/docker/certs.d/${ip}/
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt ~/.docker/tls/${ip}:4443/ ${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt ~/.docker/tls/${notaryServerEndpoint}/
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output ls -la /etc/docker/certs.d/${ip}/ ${rc} ${output}= Run And Return Rc And Output ls -la /etc/docker/certs.d/${ip}/
Log ${output} Log ${output}
${rc} ${output}= Run And Return Rc And Output ls -la ~/.docker/tls/${ip}:4443/ ${rc} ${output}= Run And Return Rc And Output ls -la ~/.docker/tls/${notaryServerEndpoint}/
Log ${output} Log ${output}
Prepare Prepare

View File

@ -54,7 +54,7 @@ Test Case - Notary Basic Verfication
Log ${output} Log ${output}
Push image ${ip} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} library hello-world:latest Push image ${ip} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} library hello-world:latest
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh ${ip} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh ${ip} ${notaryServerEndpoint}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0

View File

@ -616,7 +616,7 @@ Test Case - Admin Push Signed Image
Log ${output} Log ${output}
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh ${ip} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh ${ip} ${notaryServerEndpoint}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0

View File

@ -3,12 +3,14 @@
docker pull tomcat:latest docker pull tomcat:latest
IP=$1 IP=$1
notaryServerEndpoint=$2
PASSHRASE='Harbor12345' PASSHRASE='Harbor12345'
echo $IP echo $IP
echo "Notary server endpoint: $notaryServerEndpoint"
export DOCKER_CONTENT_TRUST=1 export DOCKER_CONTENT_TRUST=1
export DOCKER_CONTENT_TRUST_SERVER=https://$IP:4443 export DOCKER_CONTENT_TRUST_SERVER=https://$notaryServerEndpoint
export NOTARY_ROOT_PASSPHRASE=$PASSHRASE export NOTARY_ROOT_PASSPHRASE=$PASSHRASE
export NOTARY_TARGETS_PASSPHRASE=$PASSHRASE export NOTARY_TARGETS_PASSPHRASE=$PASSHRASE
@ -21,4 +23,3 @@ export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE
docker login -u admin -p Harbor12345 $IP docker login -u admin -p Harbor12345 $IP
docker tag tomcat $IP/library/tomcat:latest docker tag tomcat $IP/library/tomcat:latest
docker push $IP/library/tomcat:latest docker push $IP/library/tomcat:latest