forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Kill hanged docker build process to avoid build timeout issue. (s…
…onic-net#13726) (sonic-net#13728) Why I did it Docker build has a low rate of hanging up. It hangs on different steps. So, it looks like a bug in docker daemon. How I did it Start a daemon process to scan running time more than 1 hours, and kill the process. How to verify it
- Loading branch information
1 parent
b0416a5
commit 785f9c3
Showing
4 changed files
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
steps: | ||
- bash: | | ||
( | ||
while true | ||
do | ||
sleep 120 | ||
now=$(date +%s) | ||
pids=$(ps -C docker -o pid,etime,args | grep "docker build" | cut -d" " -f1) | ||
for pid in $pids | ||
do | ||
start=$(date --date="$(ls -dl /proc/$pid --time-style full-iso | awk '{print$6,$7}')" +%s) | ||
time_s=$(($now-$start)) | ||
if [[ $time_s -gt $(DOCKER_BUILD_TIMEOUT) ]]; then | ||
echo =========== $(date +%F%T) $time_s &>> target/daemon.log | ||
ps $pid &>> target/daemon.log | ||
sudo kill $pid | ||
fi | ||
done | ||
done | ||
) & | ||
daemon_pid=$! | ||
ps $daemon_pid | ||
echo $daemon_pid >> /tmp/azp_daemon_kill_docker_pid | ||
displayName: start daemon to kill hang docker |
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