diff --git a/Jenkinsfile b/Jenkinsfile index 69fb4e1..e58ff6b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -145,6 +145,22 @@ pipeline { } } } + stage('Cleanup') { + steps { + script { + try{ + echo "Cleaning up artifacts from the build..." + sh "result=$(docker ps -a | grep ${imagename}_${tag});if [ ! -z "$result" ]; then docker rm -f $(docker ps -a | grep ${imagename}_${tag} | awk '{print $1}');fi;docker rmi -f ${imagename}_${tag}" + sh "result=$(docker ps -a | grep ${imagename}_${tag}:arm64);if [ ! -z "$result" ]; then docker rm -f $(docker ps -a | grep ${imagename}_${tag}:arm64 | awk '{print $1}'); fi; docker rmi -f ${imagename}_${tag}:arm64" + } catch(error) { + def error_details = readFile('./debug'); + def message = "BUILD ERROR: There was a problem with cleanup of the image. \n\n ${error_details}" + sh "rm -f ./debug" + handleError(message) + } + } + } + } stage('Notify') { steps{ echo "$maintainer" diff --git a/tests/fulltest.sh b/tests/fulltest.sh index 613a6d5..c529499 100755 --- a/tests/fulltest.sh +++ b/tests/fulltest.sh @@ -15,51 +15,35 @@ sleep 60 pushd tests &>/dev/null rm -f ./lastpage.txt -#ensure webisoget is installed -#echo "ensuring that webisoget is installed..." -#rpm -q webisoget &>/dev/null -#if [ $? -ne '0' ]; then -# echo "downloading webisoget rpm" -# curl -s -L -o webisoget-2.8.7-1.x86_64.rpm https://github.internet2.edu/docker/util/blob/master/bin/webisoget-2.8.7-1.x86_64.rpm?raw=true -# if [ -s webisoget-2.8.7-1.x86_64.rpm ]; then -# echo "installing rpm..." -# sudo rpm -ivh webisoget-2.8.7-1.x86_64.rpm -# rm -f webisoget-2.8.7-1.x86_64.rpm -# else -# echo "can't get webisoget rpm..." -# exit 1 -# fi -#else -# echo "webisoget already installed..." -#fi - #ensure that name resolution is in place -#ping -c 1 sptest.example.edu &>/dev/null -#if [ $? -ne '0' ]; then +ping -c 1 sptest.example.edu &>/dev/null +if [ $? -ne '0' ]; then + echo "ERROR: You must set name resolution for the IdP test suite on this host for tests to completei (SP missing)" + exit 1 # echo "adding hosts record for sp..." # echo '127.0.0.1 sptest.example.edu' | sudo tee -a /etc/hosts -#fi -#ping -c 1 idp.example.edu &>/dev/null -#if [ $? -ne '0' ]; then +fi +ping -c 1 idp.example.edu &>/dev/null +if [ $? -ne '0' ]; then + echo "ERROR: You must set name resolution for the IdP test suite on this host for tests to completei (IdP missing)" + exit 1 # echo "adding hosts record for idp..." # echo '127.0.0.1 idp.example.edu' | sudo tee -a /etc/hosts -#fi +fi # replace FROM line in IdP Dockerfile to newly-built local image echo "Setting test suite to base from new IdP image: ${imagename}_${tag}" sed -i "s*FROM i2incommon/shib-idp:latest*FROM ${imagename}_${tag}*g" ../test-compose/idp/Dockerfile echo "Attempting full-cycle test..." -#webisoget -verbose -out ./lastpage.txt -formfile ./sptest.login -url https://sptest.example.edu:8443/secure/index.php -#build docker container +#build webisoget container pushd ../test-compose/webisoget/ &>/dev/null docker build -t webisoget . popd &>/dev/null docker run --net host -w /webisoget/ -i webisoget /bin/bash -c "rm -f lastpage.txt & webisoget -out ./lastpage.txt -maxhop 100 -timeout 120 -formfile /webisoget/sptest.login -url https://sptest.example.edu:8443/secure/index.php && cat lastpage.txt" > lastpage.txt - if [ -s ./lastpage.txt ]; then cat lastpage.txt | grep kwhite@example.edu &>/dev/null if [ $? == "0" ]; then