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] Fix docker hang issue and change template reference branch (soni…
…c-net#13894) (sonic-net#13921) Why I did it Cherry pick PR(sonic-net#13894) Azure pipeline change. Use common template to make it easy to change common steps. Fix docker hang issue. How I did it How to verify
- Loading branch information
1 parent
0095ad5
commit b23f79f
Showing
3 changed files
with
29 additions
and
4 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" " -f2) | ||
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 |