From bea103daabee0e0664cdb40833b979577fa1e0ef Mon Sep 17 00:00:00 2001 From: iadgovuser29 <33426478+iadgovuser29@users.noreply.github.com> Date: Tue, 7 May 2024 16:02:24 -0400 Subject: [PATCH] Added debug flag to aca_bootRun.sh options. JVM will launch with debug --- HIRS_AttestationCAPortal/build.gradle | 6 ++++++ package/linux/aca/aca_bootRun.sh | 10 +++++++++- package/win/aca/aca_bootRun.ps1 | 8 +++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/HIRS_AttestationCAPortal/build.gradle b/HIRS_AttestationCAPortal/build.gradle index 3a6ad9c0..7bc0f9d6 100644 --- a/HIRS_AttestationCAPortal/build.gradle +++ b/HIRS_AttestationCAPortal/build.gradle @@ -20,6 +20,12 @@ java { } } +bootRun { + if (project.hasProperty('debug')) { + jvmArgs "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:9123" + } +} + configurations { compileOnly { extendsFrom annotationProcessor diff --git a/package/linux/aca/aca_bootRun.sh b/package/linux/aca/aca_bootRun.sh index 3fea17f7..ba761cb2 100755 --- a/package/linux/aca/aca_bootRun.sh +++ b/package/linux/aca/aca_bootRun.sh @@ -27,6 +27,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 } @@ -49,6 +50,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 @@ -125,7 +130,10 @@ WEB_TLS_PARAMS="--server.ssl.key-store-password=$hirs_pki_password \ # uncomment to show spring boot and hibernate properties used as gradle arguments #echo "--args=\"$CONNECTOR_PARAMS $WEB_TLS_PARAMS\"" -if [ -z "$USE_WAR" ]; then +if [ "$DEBUG_ACA" == YES ]; then + echo "Booting with debug mode..." + ./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE" -Pdebug +elif [ -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" diff --git a/package/win/aca/aca_bootRun.ps1 b/package/win/aca/aca_bootRun.ps1 index 289dee56..32184a36 100644 --- a/package/win/aca/aca_bootRun.ps1 +++ b/package/win/aca/aca_bootRun.ps1 @@ -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 ) @@ -34,6 +35,7 @@ if ($p) { $path = $p } $war = $w -or $war +$debug = $d -or $debug $help = $h -or $help if(!(New-Object Security.Principal.WindowsPrincipal( @@ -49,6 +51,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 } @@ -71,7 +74,10 @@ if (!$DEPLOYED_WAR) { } $SPRING_PROP_FILE_FORWARDSLASHES=($global:HIRS_DATA_SPRING_PROP_FILE | ChangeBackslashToForwardSlash) -if ($w -or $war) { +if ($d -or $debug) { + echo "Booting with debug mode..." + ./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE" -Pdebug +elseif ($w -or $war) { echo "Booting the ACA from a war file..." | WriteAndLog java -jar $DEPLOYED_WAR --spring.config.location=$SPRING_PROP_FILE_FORWARDSLASHES } else {