Skip to content

Commit

Permalink
[TASK] bamboo: db dependency loop needs break condition
Browse files Browse the repository at this point in the history
Functional and acceptance tests need a db up and running.
The according container is started as dependency and a
loop delays further execution until the database connected
to its network port. This sometimes goes wrong, for
instance mssql in rare conditions does not come up. This
leads to the loop running "forever", consuming the
executing bamboo agent and the job never finishs.
The patch adds an additional break condition: If db did
not connect to the port after a minute, the job now fails.

Resolves: #87549
Releases: master, 9.5, 8.7
Change-Id: Idc45f57d9cfd2d390cea6bd5319adaf4158340df
Reviewed-on: https://review.typo3.org/59567
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
  • Loading branch information
lolli42 authored and maddy2101 committed Jan 25, 2019
1 parent 2d3aa42 commit 830e102
Showing 1 changed file with 66 additions and 36 deletions.
102 changes: 66 additions & 36 deletions Build/testing-docker/bamboo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ services:
- test
command: >
/bin/sh -c "
echo Waiting for db start...;
while ! nc -z mariadb10 3306;
do
sleep 1;
done;
echo Connected!;
echo Waiting for database start
COUNT=0
while ! nc -z mariadb10 3306; do
if [ "$${COUNT}" -ge "60" ]; then
echo Database did not come up
exit 1
fi
let "COUNT++"
sleep 1
done
echo Database is up
"
start_dependencies_acceptance_install_postgres10:
Expand All @@ -79,12 +84,17 @@ services:
- test
command: >
/bin/sh -c "
echo Waiting for db start...;
while ! nc -z postgres10 5432;
do
sleep 1;
done;
echo Connected!;
echo Waiting for database start
COUNT=0
while ! nc -z postgres10 5432; do
if [ "$${COUNT}" -ge "60" ]; then
echo Database did not come up
exit 1
fi
let "COUNT++"
sleep 1
done
echo Database is up
"
start_dependencies_acceptance_install_sqlite:
Expand All @@ -107,12 +117,17 @@ services:
- test
command: >
/bin/sh -c "
echo Waiting for db start...;
while ! nc -z mariadb10 3306;
do
sleep 1;
done;
echo Connected!;
echo Waiting for database start
COUNT=0
while ! nc -z mariadb10 3306; do
if [ "$${COUNT}" -ge "60" ]; then
echo Database did not come up
exit 1
fi
let "COUNT++"
sleep 1
done
echo Database is up
"
start_dependencies_functional_mariadb10:
Expand All @@ -125,12 +140,17 @@ services:
- test
command: >
/bin/sh -c "
echo Waiting for db start...;
while ! nc -z mariadb10 3306;
do
sleep 1;
done;
echo Connected!;
echo Waiting for database start
COUNT=0
while ! nc -z mariadb10 3306; do
if [ "$${COUNT}" -ge "60" ]; then
echo Database did not come up
exit 1
fi
let "COUNT++"
sleep 1
done
echo Database is up
"
start_dependencies_functional_mssql:
Expand All @@ -143,12 +163,17 @@ services:
- test
command: >
/bin/sh -c "
echo Waiting for db start...;
while ! nc -z mssql2017cu9 1433;
do
sleep 1;
done;
echo Connected!;
echo Waiting for database start
COUNT=0
while ! nc -z mssql2017cu9 1433; do
if [ "$${COUNT}" -ge "60" ]; then
echo Database did not come up
exit 1
fi
let "COUNT++"
sleep 1
done
echo Database is up
"
start_dependencies_functional_postgres10:
Expand All @@ -161,12 +186,17 @@ services:
- test
command: >
/bin/sh -c "
echo Waiting for db start...;
while ! nc -z postgres10 5432;
do
sleep 1;
done;
echo Connected!;
echo Waiting for database start
COUNT=0
while ! nc -z postgres10 5432; do
if [ "$${COUNT}" -ge "60" ]; then
echo Database did not come up
exit 1
fi
let "COUNT++"
sleep 1
done
echo Database is up
"
start_dependencies_functional_sqlite:
image: alpine:3.8
Expand Down

0 comments on commit 830e102

Please sign in to comment.