2023-02-16 07:58:14 -06:00
|
|
|
steps:
|
|
|
|
- bash: |
|
|
|
|
(
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
sleep 120
|
|
|
|
now=$(date +%s)
|
2023-02-21 23:00:06 -06:00
|
|
|
pids=$(ps -C docker -o pid,etime,args | grep "docker build" | cut -d" " -f2)
|
2023-02-16 07:58:14 -06:00
|
|
|
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
|