Better approach: only run cleanup during purge
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
314d9dd611
commit
f57f7b2a8c
|
@ -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 ---"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue