From d5a0aec63a7271dca2592c99751ba4c168f3f37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Mon, 11 Apr 2022 21:55:18 +0200 Subject: [PATCH] [TASK] Additionally removes dangling docker volumes with runTests.sh -u Over time dangling local anonymous docker volumes pollutes local docker environments and consuming space on core contributors discs. This patch additionally removes dangling, unused anonymous local docker volumes when updating core testing images are requested with: > Build/Scripts/runTests.sh -u Resolves: #97361 Releases: main, 11.5, 10.4 Change-Id: I6b25a88a9ff119035eea7d5efd6c415bd490a3eb Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74306 Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Oliver Bartsch <bo@cedev.de> --- Build/Scripts/runTests.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 691c45dbe33d..3e834b2fbd92 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -208,10 +208,10 @@ Options: Activate dry-run in CGL check that does not actively change files and only prints broken ones. -u - Update existing typo3/core-testing-*:latest docker images. Maintenance call to docker pull latest - versions of the main php images. The images are updated once in a while and only the youngest - ones are supported by core testing. Use this if weird test errors occur. Also removes obsolete - image versions of typo3/core-testing-*. + Update existing typo3/core-testing-*:latest docker images and remove dangling local docker volumes. + Maintenance call to docker pull latest versions of the main php images. The images are updated once + in a while and only the latest ones are supported by core testing. Use this if weird test errors occur. + Also removes obsolete image versions of typo3/core-testing-*. -v Enable verbose script output. Shows variables and docker commands. @@ -706,10 +706,18 @@ case ${TEST_SUITE} in docker-compose down ;; update) + # prune unused, dangling local volumes + echo "> prune unused, dangling local volumes" + docker volume ls -q -f driver=local -f dangling=true | awk '$0 ~ /^[0-9a-f]{64}$/ { print }' | xargs -I {} docker volume rm {} + echo "" # pull typo3/core-testing-*:latest versions of those ones that exist locally + echo "> pull typo3/core-testing-*:latest versions of those ones that exist locally" docker images typo3/core-testing-*:latest --format "{{.Repository}}:latest" | xargs -I {} docker pull {} + echo "" # remove "dangling" typo3/core-testing-* images (those tagged as <none>) + echo "> remove \"dangling\" typo3/core-testing-* images (those tagged as <none>)" docker images typo3/core-testing-* --filter "dangling=true" --format "{{.ID}}" | xargs -I {} docker rmi {} + echo "" ;; *) echo "Invalid -s option argument ${TEST_SUITE}" >&2 -- GitLab