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
This commit is contained in:
Aleksei Nikiforov
2025-02-18 16:26:46 +00:00
committed by PyTorch MergeBot
parent 6edc419d69
commit a00d2b5144

View File

@ -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