Skip to content

Commit

Permalink
add cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pcaskey committed Nov 11, 2022
1 parent 3880ff7 commit 9fb83f1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
16 changes: 16 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
38 changes: 11 additions & 27 deletions tests/fulltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9fb83f1

Please sign in to comment.