From 2a0c7b160b99e5ae7017d74a84df3cb4a2923a67 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 14 Sep 2023 06:31:08 +0530 Subject: [PATCH 1/4] Tweak run-java.sh script for some env varibales and fold run-env.sh into run-java.sh - This tweak is to avoid defining JBOSS_CONTAINER_UTIL_LOGGING_MODULE as ENV in templates/jlink/Dokcerfile - Deleted run-env.sh and folded its content to run-java.sh as its not doing anything much other than setting value of JAVA_APP_DIR Signed-off-by: Jayashree Huttanagoudar --- .../opt/jboss/container/java/run/run-env.sh | 6 ------ .../opt/jboss/container/java/run/run-java.sh | 14 ++++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 modules/run/artifacts/opt/jboss/container/java/run/run-env.sh diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-env.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-env.sh deleted file mode 100644 index 42cb7307..00000000 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-env.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Default the application dir to the S2I deployment dir -if [ -z "$JAVA_APP_DIR" ] -then JAVA_APP_DIR=/deployments -fi diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index a2160d24..33998a3e 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -3,6 +3,13 @@ # Fail on a single failed command set -eo pipefail +#These are defined explicitly here to avoid defining them in templates/jlink/Dockerfile +export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="/opt/jboss/container/util/logging" +export JBOSS_CONTAINER_JAVA_RUN_MODULE="/opt/jboss/container/java/run" + +#This is moved here after deleting run-env.sh +export JAVA_APP_DIR=/deployments + source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh" # ========================================================== @@ -96,13 +103,8 @@ load_env() { if [ -z "${JAVA_APP_DIR}" ]; then # XXX: is this correct? This is defaulted above to /deployments. Should we # define a default to the old /opt/java-run? - JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}" - else - if [ -f "${JAVA_APP_DIR}/${run_env_sh}" ]; then - source "${JAVA_APP_DIR}/${run_env_sh}" - fi + export JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}" fi - export JAVA_APP_DIR # JAVA_LIB_DIR defaults to JAVA_APP_DIR export JAVA_LIB_DIR="${JAVA_LIB_DIR:-${JAVA_APP_DIR}}" From e84cc6d205c850c49ebe0018255030ea20a62403 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 14 Sep 2023 20:43:34 +0530 Subject: [PATCH 2/4] Address review comments Signed-off-by: Jayashree Huttanagoudar --- .../opt/jboss/container/java/run/run-java.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index 33998a3e..03833c04 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -8,7 +8,10 @@ export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="/opt/jboss/container/util/logging" export JBOSS_CONTAINER_JAVA_RUN_MODULE="/opt/jboss/container/java/run" #This is moved here after deleting run-env.sh -export JAVA_APP_DIR=/deployments +# Default the application dir to the S2I deployment dir +if [ -z "$JAVA_APP_DIR" ] +then JAVA_APP_DIR=/deployments +fi source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh" @@ -100,12 +103,12 @@ load_env() { # Check also $JAVA_APP_DIR. Overrides other defaults # It's valid to set the app dir in the default script - if [ -z "${JAVA_APP_DIR}" ]; then - # XXX: is this correct? This is defaulted above to /deployments. Should we - # define a default to the old /opt/java-run? - export JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}" + if [ -f "${JAVA_APP_DIR}/${run_env_sh}" ]; then + source "${JAVA_APP_DIR}/${run_env_sh}" fi + export JAVA_APP_DIR + # JAVA_LIB_DIR defaults to JAVA_APP_DIR export JAVA_LIB_DIR="${JAVA_LIB_DIR:-${JAVA_APP_DIR}}" if [ -z "${JAVA_MAIN_CLASS}" ] && [ -z "${JAVA_APP_JAR}" ]; then From b3218d02b486ed303ffca05c88a5783d309fb1c9 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 14 Sep 2023 20:57:53 +0530 Subject: [PATCH 3/4] Use substring expansion to set the value for JBOSS_CONTAINER_UTIL_LOGGING_MODULE and JBOSS_CONTAINER_JAVA_RUN_MODULE Signed-off-by: Jayashree Huttanagoudar --- .../run/artifacts/opt/jboss/container/java/run/run-java.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index 03833c04..472697fd 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -4,8 +4,8 @@ set -eo pipefail #These are defined explicitly here to avoid defining them in templates/jlink/Dockerfile -export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="/opt/jboss/container/util/logging" -export JBOSS_CONTAINER_JAVA_RUN_MODULE="/opt/jboss/container/java/run" +export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="${JBOSS_CONTAINER_UTIL_LOGGING_MODULE-/opt/jboss/container/util/logging}" +export JBOSS_CONTAINER_JAVA_RUN_MODULE="${JBOSS_CONTAINER_JAVA_RUN_MODULE-/opt/jboss/container/java/run}" #This is moved here after deleting run-env.sh # Default the application dir to the S2I deployment dir From bef862d12683c9a3dcdb934ce7bb1821dbf8001d Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 20 Sep 2023 13:06:50 +0530 Subject: [PATCH 4/4] Address review comments for indentation and removing unwanted comment lines --- .../run/artifacts/opt/jboss/container/java/run/run-java.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index 472697fd..e64055b5 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -3,14 +3,12 @@ # Fail on a single failed command set -eo pipefail -#These are defined explicitly here to avoid defining them in templates/jlink/Dockerfile export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="${JBOSS_CONTAINER_UTIL_LOGGING_MODULE-/opt/jboss/container/util/logging}" export JBOSS_CONTAINER_JAVA_RUN_MODULE="${JBOSS_CONTAINER_JAVA_RUN_MODULE-/opt/jboss/container/java/run}" -#This is moved here after deleting run-env.sh # Default the application dir to the S2I deployment dir if [ -z "$JAVA_APP_DIR" ] -then JAVA_APP_DIR=/deployments + then JAVA_APP_DIR=/deployments fi source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh"