diff --git a/.ahoy.yml b/.ahoy.yml index 929432ec7..c55dac8cf 100644 --- a/.ahoy.yml +++ b/.ahoy.yml @@ -24,7 +24,9 @@ commands: build: usage: Build or rebuild the project. - cmd: ./scripts/drevops/build.sh + cmd: | + ahoy confirm "Running this command will remove your current database and files. Are you sure?" && + ./scripts/drevops/build.sh info: usage: Show information about this project. @@ -48,9 +50,11 @@ commands: down: usage: Stop Docker containers and remove container, images, volumes and networks. - #: Always remove dangling volumes after removing containers to prevent - #: data leaking between builds (resulting in inconsistent builds). - cmd: "if [ -f \"docker-compose.yml\" ]; then docker-compose down --volumes; fi" + cmd: | + ahoy confirm "Running this command will remove your current database. Are you sure?" && + #: Always remove dangling volumes after removing containers to prevent + #: data leaking between builds (resulting in inconsistent builds). + if [ -f "docker-compose.yml" ]; then docker-compose down --volumes; fi start: usage: Start all or specified existing Docker containers. diff --git a/scripts/drevops/build.sh b/scripts/drevops/build.sh index d180e1966..2e311b873 100755 --- a/scripts/drevops/build.sh +++ b/scripts/drevops/build.sh @@ -14,6 +14,9 @@ set -e echo "==> Building project." +# Suppress any confirmation dialogs in descendant calls. +export CONFIRM_RESPONSE=y + # Read variables from .env file, respecting existing environment variable values. # shellcheck disable=SC1090,SC1091 t=$(mktemp) && export -p > "$t" && set -a && . ./.env && set +a && . "$t" && rm "$t" && unset t