diff --git a/modules/maven/s2i/artifacts/s2i/maven-s2i b/modules/maven/s2i/artifacts/s2i/maven-s2i index fb433d29..97f749e4 100644 --- a/modules/maven/s2i/artifacts/s2i/maven-s2i +++ b/modules/maven/s2i/artifacts/s2i/maven-s2i @@ -36,10 +36,6 @@ function maven_s2i_init() { # Location of archived local Maven repository. Used with incremental builds. _MAVEN_S2I_ARCHIVED_REPO="${S2I_ARTIFACTS_DIR}/m2" - # include maven scripts - if test -r "${JBOSS_CONTAINER_MAVEN_DEFAULT_MODULE}"/scl-enable-maven; then - source "${JBOSS_CONTAINER_MAVEN_DEFAULT_MODULE}"/scl-enable-maven - fi source "${JBOSS_CONTAINER_MAVEN_DEFAULT_MODULE}"/maven.sh # Overrides for use with maven s2i diff --git a/modules/run/artifacts/run-java.sh b/modules/run/artifacts/run-java.sh index 21720628..92654ab9 100755 --- a/modules/run/artifacts/run-java.sh +++ b/modules/run/artifacts/run-java.sh @@ -247,4 +247,14 @@ startup() { # ============================================================================= # Fire up -startup $* + +if [ "${S2I_TARGET_DEPLOYMENTS_DIR-}" ]; then + run="${S2I_TARGET_DEPLOYMENTS_DIR}/bin/run.sh" + if [ -f "$run" ]; then + echo "Starting the application using the bundled $run …" + exec "$run" $* ${JAVA_ARGS} + fi +fi + +echo "Starting the Java application using ${JBOSS_CONTAINER_JAVA_RUN_MODULE}/run-java.sh $* …" +startup $* ${JAVA_ARGS} diff --git a/modules/run/tests/features/java.runtime.feature b/modules/run/tests/features/java.runtime.feature index f1225c4a..65c5dee8 100644 --- a/modules/run/tests/features/java.runtime.feature +++ b/modules/run/tests/features/java.runtime.feature @@ -15,3 +15,11 @@ Feature: Openshift OpenJDK Runtime tests (OPENJDK-474, OPENJDK-2805) And file /usr/libexec/s2i/run should exist And file /usr/libexec/s2i/run should not contain JVM_ARGS And container log should not contain unique unique + + @ubi9 + # alternative to one of previous steps, for runtime images + Scenario: OPENJDK-2968 Ensure JAVA_ARGS is passed to the running Java application + Given container is started with env + | variable | value | + | JAVA_ARGS | Hello from Cekit test | + Then container log should match regex ^INFO exec -a "java" java.*Hello from Cekit test$ diff --git a/modules/s2i/bash/artifacts/local/run b/modules/s2i/bash/artifacts/local/run index 0c6f5718..d2fc3996 100755 --- a/modules/s2i/bash/artifacts/local/run +++ b/modules/s2i/bash/artifacts/local/run @@ -11,12 +11,4 @@ source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core-hooks" # Global S2I variable setup s2i_core_env_init -export JAVA_OPTS - -if [ -f "${S2I_TARGET_DEPLOYMENTS_DIR}/bin/run.sh" ]; then - echo "Starting the application using the bundled ${S2I_TARGET_DEPLOYMENTS_DIR}/bin/run.sh ..." - exec ${DEPLOYMENTS_DIR}/bin/run.sh $args ${JAVA_ARGS} -else - echo "Starting the Java application using ${JBOSS_CONTAINER_JAVA_RUN_MODULE}/run-java.sh $args..." - exec "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/run-java.sh" $args ${JAVA_ARGS} -fi +exec "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/run-java.sh" $args diff --git a/modules/s2i/bash/tests/features/run.feature b/modules/s2i/bash/tests/features/run.feature new file mode 100644 index 00000000..90fcf18c --- /dev/null +++ b/modules/s2i/bash/tests/features/run.feature @@ -0,0 +1,12 @@ +@ubi9/openjdk-11 +@ubi9/openjdk-17 +@ubi9/openjdk-21 +Feature: S2I run script tests + + Scenario: OPENJDK-2968 application run script is invoked instead of image run script + Given s2i build https://github.com/jmtd/openjdk-test-applications from OPENJDK-2968-bin-custom-run with env using OPENJDK-2968-custom-run + | variable | value | + | JAVA_ARGS | percolated | + Then container log should not contain Starting the Java application using /opt/jboss/container/java/run/run-java.sh + And container log should contain hello world + And container log should contain args=percolated