From a00d2b514477b7dee15111810a4c43788de4a5e7 Mon Sep 17 00:00:00 2001 From: Aleksei Nikiforov Date: Tue, 18 Feb 2025 16:26:46 +0000 Subject: [PATCH] s390x: add cleanup for cancelled docker image builds (#147110) When podman image build is cancelled, a couple of processes are left behind, and their existence prevents proper shutdown of runner container. Add cleanup step at the end of workflow using new option recently introduced in podman: https://github.com/containers/podman/pull/25102 Example of job preventing s390x worker cleaning up and restarting properly: https://github.com/pytorch/pytorch/actions/runs/13289159296/job/37105230728 Pull Request resolved: https://github.com/pytorch/pytorch/pull/147110 Approved by: https://github.com/huydhn --- .github/workflows/build-manywheel-images-s390x.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build-manywheel-images-s390x.yml b/.github/workflows/build-manywheel-images-s390x.yml index 85acac777886..d282de96ba46 100644 --- a/.github/workflows/build-manywheel-images-s390x.yml +++ b/.github/workflows/build-manywheel-images-s390x.yml @@ -57,3 +57,12 @@ jobs: - name: Build Docker Image run: | .ci/docker/manywheel/build.sh manylinuxs390x-builder:cpu-s390x + + - name: Cleanup docker + if: cancelled() + shell: bash + run: | + # if podman build command is interrupted, + # it can leave a couple of processes still running. + # order them to stop for clean shutdown. + docker system prune --build -f || true