From 43886deee96fce9cb4c52a8c1f21c436de0a1852 Mon Sep 17 00:00:00 2001 From: Ryan Emerle Date: Mon, 7 Feb 2022 14:47:18 -0500 Subject: [PATCH] Update sbt script to allow for debugging [ci skip] --- build/sbt.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build/sbt.sh b/build/sbt.sh index 3e5030348..edece2fbd 100755 --- a/build/sbt.sh +++ b/build/sbt.sh @@ -7,10 +7,12 @@ usage() { echo "USAGE: sbt.sh [options]" echo -e "\t-d, --debug enable debugging" echo -e "\t-p, --debug-port the debug port (default: 5021)" + echo -e "\t-e, --expose expose one or more ports using the Docker format for exposing ports" } DEBUG_SETTINGS="" DEBUG_PORT=5021 +EXPOSE_PORTS="" while [[ $# -gt 0 ]]; do case "$1" in --debug | -d) @@ -22,6 +24,11 @@ while [[ $# -gt 0 ]]; do shift shift ;; + --expose | -e) + EXPOSE_PORTS="${EXPOSE_PORTS} -p \"$2\"" + shift + shift + ;; *) usage exit 1 @@ -30,8 +37,13 @@ while [[ $# -gt 0 ]]; do done if [ "${DEBUG_SETTINGS}" != "" ]; then - DEBUG_SETTINGS="${DEBUG_SETTINGS},address=${DEBUG_PORT}\" -p \"${DEBUG_PORT}:${DEBUG_PORT}\"" + DEBUG_SETTINGS="${DEBUG_SETTINGS},address=${DEBUG_PORT}\"" + + # If given a debug port outside of the default range, expose the selected port + if [[ "$DEBUG_PORT" -lt 5020 ]] || [[ "$DEBUG_PORT" -gt 5030 ]]; then + DEBUG_SETTINGS="${DEBUG_SETTINGS} -p \"${DEBUG_PORT}:${DEBUG_PORT}\"" + fi fi cd "$DIR/../test/api/integration" -make build DOCKER_PARAMS="--build-arg SKIP_API_BUILD=true" && make run-local WITH_ARGS="sbt" DOCKER_PARAMS="-p \"5020-5030:5020-5030\" ${DEBUG_SETTINGS} -e RUN_SERVICES=none --env-file \"$DIR/../test/api/integration/.env.integration\"" +make build DOCKER_PARAMS="--build-arg SKIP_API_BUILD=true" && make run-local WITH_ARGS="sbt" DOCKER_PARAMS="-p \"5020-5030:5020-5030\" ${DEBUG_SETTINGS} ${EXPOSE_PORTS} -e RUN_SERVICES=none --env-file \"$DIR/../test/api/integration/.env.integration\""