.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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-04-03 16:08:37 +02:00
parent ae86473675
commit 24ce5cbc62
2 changed files with 14 additions and 1 deletions
+3
View File
@@ -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: |
+11 -1
View File
@@ -15,6 +15,10 @@ usage: test/env [<OPTS>] -f <IMAGE> -q <QENETH-DIR> <COMMAND> [<ARGS>...]
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=
;;