diff --git a/Jenkinsfile b/Jenkinsfile index 9cb326b..66cc578 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,7 +50,11 @@ pipeline { sh 'midpoint/download-midpoint' docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") { def baseImg = docker.build("$maintainer/$imagename", "--no-cache midpoint/midpoint-server") - sh 'env NOCOLOR=true ./test.sh' + try { + sh 'env NOCOLOR=true ./test.sh' + } finally { + sh './cleanup.sh' + } baseImg.push("$tag") } } diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 0000000..649bafd --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +midpoint/cleanup.sh diff --git a/midpoint/cleanup.sh b/midpoint/cleanup.sh new file mode 100755 index 0000000..b9fe089 --- /dev/null +++ b/midpoint/cleanup.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd "$(dirname "$0")" +echo "Cleaning up containers and images in `pwd`" + +docker-compose down -v diff --git a/midpoint/docker-compose.yml b/midpoint/docker-compose.yml index 32d8ee1..338a67f 100644 --- a/midpoint/docker-compose.yml +++ b/midpoint/docker-compose.yml @@ -10,8 +10,8 @@ services: volumes: - midpoint_mysql:/var/lib/mysql - midpoint_data:/var/lib/mysqlmounted - environment: - - CREATE_NEW_DATABASE=if_needed +# environment: +# - CREATE_NEW_DATABASE=if_needed midpoint-server: build: ./midpoint-server/ diff --git a/midpoint/test.sh b/midpoint/test.sh index 93533d3..2570c4b 100755 --- a/midpoint/test.sh +++ b/midpoint/test.sh @@ -5,6 +5,11 @@ trap 'exitcode=$? ; error "Exiting midpoint/test.sh because of an error ($exitco cd "$(dirname "$0")" . ../test/common.sh +heading "Cleaning up containers and volumes if they exist" +docker-compose down -v || true +ok "Done" +echo + heading "Composing midPoint..." docker-compose up --no-start ok "midPoint composed OK" diff --git a/midpoint/test/t110-get-administrator.sh b/midpoint/test/t110-get-administrator.sh index 43b8af9..55d5a4f 100755 --- a/midpoint/test/t110-get-administrator.sh +++ b/midpoint/test/t110-get-administrator.sh @@ -1,5 +1,8 @@ #!/bin/bash +trap 'exitcode=$? ; error "Exiting $0 because of an error ($exitcode) occurred" ; exit $exitcode' ERR +. ../test/common.sh + curl -k --user administrator:5ecr3t -H "Content-Type: application/xml" -X GET "https://localhost:8443/midpoint/ws/rest/users/00000000-0000-0000-0000-000000000002" >/tmp/admin.xml grep -q "administrator"