blob: 38a135b0aa1580802951a103c2be7dd4a2521a8b [file] [log] [blame]
#!/bin/bash
DOCKER_ORG="apache"
# These are the images that are currently being used, so don't `docker rmi` them on cleanup.
KEEP_IMAGES=(
couchdbci-debian:buster-erlang-20.3.8.26-1
couchdbci-debian:arm64v8-buster-erlang-20.3.8.26-1
couchdbci-debian:buster-erlang-all
couchdbci-centos:8-erlang-20.3.8.26-1
couchdbci-centos:7-erlang-20.3.8.26-1
couchdbci-ubuntu:focal-erlang-20.3.8.26-1
couchdbci-ubuntu:bionic-erlang-20.3.8.26-1
couchdbci-debian:erlang-20
couchdbci-debian:erlang-21
couchdbci-debian:erlang-22
couchdbci-debian:erlang-23
couchdbci-debian:erlang-24
couchdbci-debian:buster-erlang-24.2
couchdbci-debian:bullseye-erlang-24.2
couchdbci-centos:8-erlang-24.2
couchdbci-centos:7-erlang-24.2
couchdbci-ubuntu:focal-erlang-24.2
couchdbci-ubuntu:bionic-erlang-24.2
)
# Base images are used for building old libmozjs, primarily.
BASE_IMAGES=(
couchdbci-debian:ppc64le-buster-base
)
# These images layer in the rest of the CouchDB build chain, and 1 or more Erlang versions.
IMAGES=(
couchdbci-debian:arm64v8-buster-erlang-20.3.8.25-1
couchdbci-debian:ppc64le-buster-erlang-20.3.8.25-1
couchdbci-centos:6-erlang-20.3.8.25-1
couchdbci-centos:6-erlang-19.3.6
couchdbci-centos:7-erlang-19.3.6
)
if [ "$(date +%u)" -ne "1" ]; then
LIST=( ${KEEP_IMAGES[*]})
else
LIST=( ${IMAGES[*]} ${BASE_IMAGES[*]} )
fi
for image in ${LIST[*]}
do
echo docker pull ${DOCKER_ORG}/${image}
docker pull ${DOCKER_ORG}/${image}
# We don't want to delete the current working set of images.
if ! printf '%s\n' "${KEEP_IMAGES[@]}" | grep -q -P "^${image}$"; then
echo docker rmi ${DOCKER_ORG}/$image
docker rmi ${DOCKER_ORG}/$image
fi
done
docker system prune -f