diff --git a/build__common.sh b/build__common.sh index 8017886..5cd6ef8 100644 --- a/build__common.sh +++ b/build__common.sh @@ -10,6 +10,7 @@ common_start() { deployment="${1:-${deployment:-}}" action="${action:-deploy}" + persistence="${persistence:-y}" # detach on production deployment if [ "${deployment}" = 'prod' ]; then @@ -29,12 +30,23 @@ common_start() { idhub="${idhub:-idhub__${target}}" idhub1="${idhub1:-idhub1__${target}}" idhub2="${idhub2:-idhub2__${target}}" + + if [ "${persistence}" = "n" ]; then + # no data persistence: cleanup previous possible data + rm -rf "./${idhub}" + fi } common_end() { dc_file="docker-compose__${target}.yml" - docker compose -p ${target} -f ${dc_file} down -v || true + + if [ "${persistence}" = "n" ]; then + # no data persistence, then cleanup docker volume + vol_arg='-v' + fi + + docker compose -p ${target} -f ${dc_file} down ${vol_arg:-} || true make idhub_build if [ "${action:-}" = "deploy" ]; then diff --git a/build__instance-autotest.sh b/build__instance-autotest.sh index 94aaa01..f3d805c 100755 --- a/build__instance-autotest.sh +++ b/build__instance-autotest.sh @@ -17,10 +17,9 @@ main() { idhub="idhub__${target}" - common_start + persistence='n' - # no data persistence: cleanup previous possible data - rm -rf "./${idhub}" + common_start # detect if is new if [ ! -f "./${idhub}" ]; then