From 24ce5cbc62b9c311edff7df06913c2fc2e2df6be Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 28 Mar 2024 16:47:31 +0100 Subject: [PATCH] .github: clean up unused containers and images before starting Error: error creating container storage: the container name "infamy0" is already in use by "2011c2d7cb1737b788b854a8bd08e519f3cbd6e36dae4975784978cff1f238fc". You have to remove that container to be able to reuse that name.: that name is already in use make[1]: *** [/home/github-runner/actions-runner/_work/infix/infix/test/test.mk:6: test-unit] Error 125 Signed-off-by: Joachim Wiberg --- .github/workflows/regression.yml | 3 +++ test/env | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index aa45cc7f..91e56b65 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -22,6 +22,9 @@ jobs: - uses: actions/checkout@v4 with: submodules: 'true' + - name: Clean up cruft ... + run: | + ./test/env -c - name: Set Build Variables id: vars run: | diff --git a/test/env b/test/env index 805b231c..0da80757 100755 --- a/test/env +++ b/test/env @@ -15,6 +15,10 @@ usage: test/env [] -f -q [...] Options: + -c + Clean up cruft, lingering images, old containers, unused volumes. + Used by GitHub action to prevent issues with runnign tests. + -C Don't containerize the command, run it directly in the current namespaces @@ -104,8 +108,14 @@ name() containerize=yes [ -c /dev/kvm ] && kvm="--device=/dev/kvm" -while getopts "Cf:hiKp:q:t:" opt; do +while getopts "cCf:hiKp:q:t:" opt; do case ${opt} in + c) + $(runner) image prune -af + $(runner) volume prune -f + $(runner) container prune -f + exit 0 + ;; C) containerize= ;;