When docker up fails in core tests retry one time

This commit is contained in:
Théophile Diot 2023-05-15 08:47:52 -04:00
parent 82aadfa38c
commit 7bf4c11bc5
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
24 changed files with 220 additions and 70 deletions

View File

@ -56,8 +56,14 @@ do
echo "🤖 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🤖 Up failed ❌"
exit 1
echo "🤖 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🤖 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -65,8 +65,14 @@ do
echo "🔐 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🔐 Up failed ❌"
exit 1
echo "🔐 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🔐 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -72,8 +72,14 @@ do
echo "📟 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "📟 Up failed ❌"
exit 1
echo "📟 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "📟 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -200,8 +200,14 @@ do
echo "🏴 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🏴 Up failed ❌"
exit 1
echo "🏴 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🏴 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -52,8 +52,14 @@ do
echo "📦 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "📦 Up failed ❌"
exit 1
echo "📦 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "📦 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -61,8 +61,14 @@ do
echo "🕸️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🕸️ Up failed ❌"
exit 1
echo "🕸️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🕸️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy
@ -96,12 +102,12 @@ do
docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from tests 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🏴 Test \"$test\" failed ❌"
echo "🕸️ Test \"$test\" failed ❌"
echo "🛡️ Showing BunkerWeb, BunkerWeb Scheduler and Custom API logs ..."
docker compose logs bw bw-scheduler bunkernet-api
exit 1
else
echo "🏴 Test \"$test\" succeeded ✅"
echo "🕸️ Test \"$test\" succeeded ✅"
fi
manual=1

View File

@ -66,8 +66,14 @@ do
echo "📝 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "📝 Up failed ❌"
exit 1
echo "📝 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "📝 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -81,8 +81,14 @@ do
echo "🛰️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🛰️ Up failed ❌"
exit 1
echo "🛰️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🛰️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -57,8 +57,14 @@ do
echo "🌍 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🌍 Up failed ❌"
exit 1
echo "🌍 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🌍 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -68,8 +68,14 @@ do
echo "🔏 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🔏 Up failed ❌"
exit 1
echo "🔏 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🔏 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -64,8 +64,14 @@ trap cleanup_stack EXIT
echo "💾 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "💾 Up failed ❌"
exit 1
echo "💾 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "💾 Up failed ❌"
exit 1
fi
fi
echo "💾 Initializing workspace ..."
@ -133,8 +139,14 @@ do
echo "💾 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "💾 Up failed ❌"
exit 1
echo "💾 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "💾 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -84,8 +84,14 @@ do
echo "🚫 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🚫 Up failed ❌"
exit 1
echo "🚫 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🚫 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -57,8 +57,14 @@ do
echo "⭕ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "⭕ Up failed ❌"
exit 1
echo "⭕ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "⭕ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -101,7 +101,7 @@ do
find . -type f -name 'docker-compose.*' -exec sed -i 's@GREYLIST_IP_URLS: "http://greylist-api:8080/ip"@GREYLIST_IP_URLS: ""@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@GREYLIST_RDNS: ""@GREYLIST_RDNS: ".bw-services"@' {} \;
elif [ "$test" = "rdns_global" ] ; then
echo "🏴 Running tests when greylist's rdns also scans local ip addresses ..."
echo "🏁 Running tests when greylist's rdns also scans local ip addresses ..."
find . -type f -name 'docker-compose.*' -exec sed -i 's@GREYLIST_RDNS_GLOBAL: "yes"@GREYLIST_RDNS_GLOBAL: "no"@' {} \;
elif [ "$test" = "rdns_urls" ] ; then
echo "🏁 Running tests with greylist's rdns url set to http://greylist-api:8080/rdns ..."
@ -138,8 +138,14 @@ do
echo "🏁 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🏁 Up failed ❌"
exit 1
echo "🏁 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🏁 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -52,8 +52,14 @@ do
echo "🗜️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🗜️ Up failed ❌"
exit 1
echo "🗜️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🗜️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -108,8 +108,14 @@ do
echo "🎛️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🎛️ Up failed ❌"
exit 1
echo "🎛️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🎛️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -35,8 +35,14 @@ echo "💉 Running tests while injecting TEST into the HTML page ..."
echo "💉 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "💉 Up failed ❌"
exit 1
echo "💉 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "💉 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -86,8 +86,14 @@ do
echo "🎚️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🎚️ Up failed ❌"
exit 1
echo "🎚️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🎚️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -57,8 +57,14 @@ do
echo "👮 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "👮 Up failed ❌"
exit 1
echo "👮 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "👮 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -54,8 +54,14 @@ do
echo "↩️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "↩️ Up failed ❌"
exit 1
echo "↩️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "↩️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -56,8 +56,14 @@ do
echo "🕵️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🕵️ Up failed ❌"
exit 1
echo "🕵️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🕵️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -1,16 +1,16 @@
#!/bin/bash
echo "🔐 Building selfsigned stack ..."
echo "🔑 Building selfsigned stack ..."
# Starting stack
docker compose pull bw-docker
if [ $? -ne 0 ] ; then
echo "🔐 Pull failed ❌"
echo "🔑 Pull failed ❌"
exit 1
fi
docker compose -f docker-compose.test.yml build
if [ $? -ne 0 ] ; then
echo "🔐 Build failed ❌"
echo "🔑 Build failed ❌"
exit 1
fi
@ -27,16 +27,16 @@ cleanup_stack () {
fi
fi
echo "🔐 Cleaning up current stack ..."
echo "🔑 Cleaning up current stack ..."
docker compose down -v --remove-orphans 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🔐 Down failed ❌"
echo "🔑 Down failed ❌"
exit 1
fi
echo "🔐 Cleaning up current stack done ✅"
echo "🔑 Cleaning up current stack done ✅"
}
# Cleanup stack on exit
@ -45,25 +45,31 @@ trap cleanup_stack EXIT
for test in "deactivated" "activated" "tweaked_options"
do
if [ "$test" = "deactivated" ] ; then
echo "🔐 Running tests without selfsigned ..."
echo "🔑 Running tests without selfsigned ..."
elif [ "$test" = "activated" ] ; then
echo "🔐 Running tests with selfsigned activated ..."
echo "🔑 Running tests with selfsigned activated ..."
find . -type f -name 'docker-compose.*' -exec sed -i 's@GENERATE_SELF_SIGNED_SSL: "no"@GENERATE_SELF_SIGNED_SSL: "yes"@' {} \;
elif [ "$test" = "tweaked_options" ] ; then
echo "🔐 Running tests with selfsigned's options tweaked ..."
echo "🔑 Running tests with selfsigned's options tweaked ..."
find . -type f -name 'docker-compose.*' -exec sed -i 's@SELF_SIGNED_SSL_EXPIRY: "365"@SELF_SIGNED_SSL_EXPIRY: "30"@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@SELF_SIGNED_SSL_SUBJ: "/CN=www.example.com/"@SELF_SIGNED_SSL_SUBJ: "/CN=example.com/"@' {} \;
fi
echo "🔐 Starting stack ..."
echo "🔑 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🔐 Up failed ❌"
exit 1
echo "🔑 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🔑 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy
echo "🔐 Waiting for stack to be healthy ..."
echo "🔑 Waiting for stack to be healthy ..."
i=0
while [ $i -lt 120 ] ; do
containers=("selfsigned-bw-1" "selfsigned-bw-scheduler-1")
@ -76,7 +82,7 @@ do
fi
done
if [ "$healthy" = "true" ] ; then
echo "🔐 Docker stack is healthy ✅"
echo "🔑 Docker stack is healthy ✅"
break
fi
sleep 1
@ -84,7 +90,7 @@ do
done
if [ $i -ge 120 ] ; then
docker compose logs
echo "🔐 Docker stack is not healthy ❌"
echo "🔑 Docker stack is not healthy ❌"
exit 1
fi
@ -93,12 +99,12 @@ do
docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from tests 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🔐 Test \"$test\" failed ❌"
echo "🔑 Test \"$test\" failed ❌"
echo "🛡️ Showing BunkerWeb and BunkerWeb Scheduler logs ..."
docker compose logs bw bw-scheduler
exit 1
else
echo "🔐 Test \"$test\" succeeded ✅"
echo "🔑 Test \"$test\" succeeded ✅"
fi
manual=1
@ -109,4 +115,4 @@ do
done
end=1
echo "🔐 Tests are done ! ✅"
echo "🔑 Tests are done ! ✅"

View File

@ -57,8 +57,14 @@ do
echo "🧳 Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🧳 Up failed ❌"
exit 1
echo "🧳 Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🧳 Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy

View File

@ -102,7 +102,7 @@ do
find . -type f -name 'docker-compose.*' -exec sed -i 's@WHITELIST_IP_URLS: "http://whitelist-api:8080/ip"@WHITELIST_IP_URLS: ""@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@WHITELIST_RDNS: ""@WHITELIST_RDNS: ".bw-services"@' {} \;
elif [ "$test" = "rdns_global" ] ; then
echo "🏴 Running tests when whitelist's rdns also scans local ip addresses ..."
echo "🏳️ Running tests when whitelist's rdns also scans local ip addresses ..."
find . -type f -name 'docker-compose.*' -exec sed -i 's@WHITELIST_RDNS_GLOBAL: "yes"@WHITELIST_RDNS_GLOBAL: "no"@' {} \;
elif [ "$test" = "rdns_urls" ] ; then
echo "🏳️ Running tests with whitelist's rdns url set to http://whitelist-api:8080/rdns ..."
@ -139,8 +139,14 @@ do
echo "🏳️ Starting stack ..."
docker compose up -d 2>/dev/null
if [ $? -ne 0 ] ; then
echo "🏳️ Up failed ❌"
exit 1
echo "🏳️ Up failed, retrying ... ⚠️"
manual=1
cleanup_stack
manual=0
if [ $? -ne 0 ] ; then
echo "🏳️ Up failed ❌"
exit 1
fi
fi
# Check if stack is healthy