Better approach: only run cleanup during purge
continuous-integration/drone/push Build is passing Details

This commit is contained in:
3wc 2020-09-26 16:14:32 +02:00
parent 314d9dd611
commit f57f7b2a8c
1 changed files with 1 additions and 5 deletions

View File

@ -67,14 +67,11 @@ run_stack_wait() {
run_purge() {
echo "--- start purge ---"
docker -H "$DOCKER_HOST" stack rm "$PLUGIN_STACK"
echo "--- end purge ---"
}
run_cleanup() {
echo "--- start cleanup ---"
# See https://github.com/moby/moby/issues/30942#issuecomment-540699206
until [ -z "$(docker stack ps "$PLUGIN_STACK" -q)" ]; do sleep 1; done
docker -H "$DOCKER_HOST" system prune --all --volumes --force
# try and remove all secrets; Docker will leave ones which are in use
docker -H "$DOCKER_HOST" secret ls --format '{{ .Name }}' | xargs -i sh -c "echo {}; docker -H \"$DOCKER_HOST\" secret rm {} || true"
echo "--- end cleanup ---"
@ -96,7 +93,6 @@ run_plugin() {
run_purge
fi
run_cleanup
echo "--- end ssh-stack-deploy ---"
}