diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index 68ce08fa41..51ad919817 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -102,6 +102,25 @@ jobs: buildSteps: - template: template-skipvstest.yml - bash: | + ( + while true + do + sleep 120 + now=$(date +%s) + pids=$(ps aux | grep -v grep | grep -E "^.{,100}docker build" | awk '{print$2}') + 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=$! set -ex if [ $(GROUP_NAME) == vs ]; then if [ $(dbg_image) == yes ]; then @@ -164,5 +183,6 @@ jobs: fi make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin fi + sudo kill $daemon_pid displayName: "Build sonic image" - template: check-dirty-version.yml diff --git a/.azure-pipelines/template-variables.yml b/.azure-pipelines/template-variables.yml index 027dfee998..42d46182d2 100644 --- a/.azure-pipelines/template-variables.yml +++ b/.azure-pipelines/template-variables.yml @@ -4,3 +4,5 @@ variables: SONIC_SLAVE_DOCKER_DRIVER: 'overlay2' SONIC_BUILD_RETRY_COUNT: 3 SONIC_BUILD_RETRY_INTERVAL: 600 + DOCKER_BUILDKIT: 0 + DOCKER_BUILD_TIMEOUT: 3600