-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kie-issues#747: tweak CI image docker startup (#1140)
Co-authored-by: jstastny-cz <[email protected]>
- Loading branch information
1 parent
90ba73b
commit c17c50e
Showing
9 changed files
with
61 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,15 @@ | ||
#!/bin/bash | ||
source /opt/bash-utils/logger.sh | ||
|
||
function wait_for_process () { | ||
local max_time_wait=30 | ||
local process_name="$1" | ||
local waited_sec=0 | ||
while ! pgrep "$process_name" >/dev/null && ((waited_sec < max_time_wait)); do | ||
INFO "Process $process_name is not running yet. Retrying in 1 seconds" | ||
INFO "Waited $waited_sec seconds of $max_time_wait seconds" | ||
sleep 1 | ||
((waited_sec=waited_sec+1)) | ||
if ((waited_sec >= max_time_wait)); then | ||
return 1 | ||
fi | ||
done | ||
sudo chown root:docker /var/run/docker.sock | ||
return 0 | ||
} | ||
|
||
INFO "Starting supervisor" | ||
sudo bash -c "/usr/bin/supervisord >> /dev/null 2>&1" & | ||
|
||
INFO "Waiting for docker to be running" | ||
wait_for_process dockerd | ||
source wait-for-docker.sh | ||
if [ $? -ne 0 ]; then | ||
ERROR "dockerd is not running after max time" | ||
exit 1 | ||
else | ||
sudo chown root:docker /var/run/docker.sock | ||
INFO "dockerd is running" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
source wait-for-process.sh | ||
|
||
wait_for_process dockerd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
source /opt/bash-utils/logger.sh | ||
set -e | ||
function wait_for_process () { | ||
local max_time_wait=30 | ||
local process_name="$1" | ||
local waited_sec=0 | ||
while ! pgrep "$process_name" >/dev/null && ((waited_sec < max_time_wait)); do | ||
INFO "Process $process_name is not running yet. Retrying in 1 seconds" | ||
INFO "Waited $waited_sec seconds of $max_time_wait seconds" | ||
sleep 1 | ||
((waited_sec=waited_sec+1)) | ||
if ((waited_sec >= max_time_wait)); then | ||
return 1 | ||
fi | ||
done | ||
INFO "Process $process_name successfully started." | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters