mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
ci: always prune all dangling bitcoin-ci-test images
Since all bitcoin-ci-test images are now labeled, we can always prune all dangling images, regardless of whether we are in RESTART_CI_DOCKER_BEFORE_RUN. To be safe, still prune all images if RESTART_CI_DOCKER_BEFORE_RUN in case the filtering doesn't work, or if images were created on an earlier version that did not assign labels.
This commit is contained in:
parent
ce1699706e
commit
e44c574650
1 changed files with 5 additions and 0 deletions
|
@ -32,9 +32,14 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
|
||||||
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
|
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
|
||||||
echo "Restart docker before run to stop and clear all containers started with --rm"
|
echo "Restart docker before run to stop and clear all containers started with --rm"
|
||||||
podman container rm --force --all # Similar to "systemctl restart docker"
|
podman container rm --force --all # Similar to "systemctl restart docker"
|
||||||
|
|
||||||
|
# Still prune everything in case the filtered pruning doesn't work, or if labels were not set
|
||||||
|
# on a previous run. Belt and suspenders approach, should be fine to remove in the future.
|
||||||
echo "Prune all dangling images"
|
echo "Prune all dangling images"
|
||||||
docker image prune --force
|
docker image prune --force
|
||||||
fi
|
fi
|
||||||
|
echo "Prune all dangling $CI_IMAGE_LABEL images"
|
||||||
|
docker image prune --force --filter "label=$CI_IMAGE_LABEL"
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
CI_CONTAINER_ID=$(docker run --cap-add LINUX_IMMUTABLE $CI_CONTAINER_CAP --rm --interactive --detach --tty \
|
CI_CONTAINER_ID=$(docker run --cap-add LINUX_IMMUTABLE $CI_CONTAINER_CAP --rm --interactive --detach --tty \
|
||||||
|
|
Loading…
Add table
Reference in a new issue