sonic-buildimage/.azure-pipelines/cleanup.yml
Liu Shilong 22e46207c8
[ci] Kill hanged docker build process to avoid build timeout issue. (#13726)
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
2023-02-16 21:58:14 +08:00

22 lines
639 B
YAML

steps:
- script: |
set -x
# kill daemon process
ps $(cat /tmp/azp_daemon_kill_docker_pid)
sudo kill $(cat /tmp/azp_daemon_kill_docker_pid)
rm /tmp/azp_daemon_kill_docker_pid
if sudo [ -f /var/run/march/docker.pid ] ; then
pid=`sudo cat /var/run/march/docker.pid` ; sudo kill $pid
fi
sudo rm -f /var/run/march/docker.pid
sudo rm -rf /data/march/docker
# clean native docker build
if sudo [ -f dockerfs/var/run/docker.pid ] ; then
pid=`sudo cat dockerfs/var/run/docker.pid` ; sudo kill $pid
fi
sudo rm -rf $(ls -A1)
condition: always()
displayName: "Clean Workspace"