Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 boot run debug option #771

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HIRS_AttestationCAPortal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ java {
}
}

bootRun {
if (project.hasProperty('debug')) {
jvmArgs project.debug
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
Expand Down
24 changes: 19 additions & 5 deletions package/linux/aca/aca_bootRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
LOG_FILE=/dev/null
GRADLE_WRAPPER="./gradlew"
DEPLOYED_WAR=false
DEBUG_OPTIONS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:9123"

# Check for sudo or root user
if [ "$EUID" -ne 0 ]
Expand All @@ -27,6 +28,7 @@ help () {
echo " options:"
echo " -p | --path Path to the HIRS_AttestationCAPortal.war file"
echo " -w | --war Use deployed war file"
echo " -d | --debug Launch the JVM with a debug port open"
echo " -h | --help Print this help"
echo
}
Expand All @@ -49,6 +51,10 @@ while [[ $# -gt 0 ]]; do
WAR_PATH="/opt/hirs/aca/HIRS_AttestationCAPortal.war"
DEPLOYED_WAR=true
;;
-d|--debug)
DEBUG_ACA=YES
shift
;;
-h|--help)
help
exit 0
Expand Down Expand Up @@ -127,11 +133,19 @@ WEB_TLS_PARAMS="--server.ssl.key-store-password=$hirs_pki_password \

if [ -z "$USE_WAR" ]; then
echo "Booting the ACA from local build..."
# ./gradlew bootRun --args="$CONNECTOR_PARAMS$WEB_TLS_PARAMS"
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE"
if [ "$DEBUG_ACA" == YES ]; then
echo "... in debug"
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE" -Pdebug="$DEBUG_OPTIONS"
else
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE"
fi
else
echo "Booting the ACA from a war file..."
# java -jar $WAR_PATH $CONNECTOR_PARAMS$WEB_TLS_PARAMS &
java -jar $WAR_PATH --spring.config.location=$SPRING_PROP_FILE &
exit 0
if [ "$DEBUG_ACA" == YES ]; then
echo "... in debug"
java $DEBUG_OPTIONS -jar $WAR_PATH --spring.config.location=$SPRING_PROP_FILE &
else
java -jar $WAR_PATH --spring.config.location=$SPRING_PROP_FILE &
fi
exit 0
fi
19 changes: 17 additions & 2 deletions package/win/aca/aca_bootRun.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
param (
[string]$p, [string]$path = $null,
[switch]$w, [switch]$war = $false,
[switch]$d, [switch]$debug = $false,
[switch]$h, [switch]$help = $false
)

Expand All @@ -9,6 +10,7 @@ $ACA_COMMON_SCRIPT=(Join-Path $APP_HOME 'aca_common.ps1')
$ALG="RSA" # or "ECC"
$GRADLE_WRAPPER='./gradlew'
$DEPLOYED_WAR=$null
$DEBUG_OPTIONS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:9123'

# Load other scripts
. $ACA_COMMON_SCRIPT
Expand All @@ -34,6 +36,7 @@ if ($p) {
$path = $p
}
$war = $w -or $war
$debug = $d -or $debug
$help = $h -or $help

if(!(New-Object Security.Principal.WindowsPrincipal(
Expand All @@ -49,6 +52,7 @@ if ($help) {
echo " options:"
echo " -p | --path Path to the HIRS_AttestationCAPortal.war file"
echo " -w | --war Use deployed war file"
echo " -d | --debug Launch the JVM with a debug port open"
echo " -h | --help Print this help"
exit 1
}
Expand All @@ -73,8 +77,19 @@ if (!$DEPLOYED_WAR) {
$SPRING_PROP_FILE_FORWARDSLASHES=($global:HIRS_DATA_SPRING_PROP_FILE | ChangeBackslashToForwardSlash)
if ($w -or $war) {
echo "Booting the ACA from a war file..." | WriteAndLog
java -jar $DEPLOYED_WAR --spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES
if ($d -or $debug) {
echo "... in debug"
java $DEBUG_OPTIONS -jar $DEPLOYED_WAR --spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES
} else {
java -jar $DEPLOYED_WAR --spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES
}
} else {
echo "Booting the ACA from local build..." | WriteAndLog
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES"
if ($d -or $debug) {
echo "... in debug"
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES" -Pdebug="$$DEBUG_OPTIONS"
} else {
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES"
}

}
Loading