-
Notifications
You must be signed in to change notification settings - Fork 3
/
kafka_wait.sh
executable file
·31 lines (29 loc) · 1.01 KB
/
kafka_wait.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
GITHUB_RUN_ID=${GITHUB_RUN_ID:-123}
function checkServiceByNameAndMessage() {
name=$1
message=$2
docker-compose -p "${GITHUB_RUN_ID}" logs "$name" > "logs"
string=$(cat logs)
counter=0
echo "Project $GITHUB_RUN_ID"
echo -n "Starting service $name "
while [[ "$string" != *"$message"* ]]
do
echo -e -n "\e[93m-\e[39m"
docker-compose -p "${GITHUB_RUN_ID}" logs "$name" > "logs"
string=$(cat logs)
sleep 1
counter=$((counter+1))
if [ $counter -eq 200 ]; then
echo -e "\e[91mFailed after $counter tries! Cypress tests may fail!!\e[39m"
echo "$string"
exit 1
fi
done
counter=$((counter+1))
echo -e "\e[92m Succeeded starting $name Service after $counter tries!\e[39m"
}
checkServiceByNameAndMessage jofisaes-vma-zookeeper 'binding to port'
checkServiceByNameAndMessage jofisaes-vma-broker 'Created metrics reporter topic'
checkServiceByNameAndMessage jofisaes-schemaregistry 'started, listening for requests'