Skip to content

WIP [OPENJDK-2968] Runtime images don't properly support JAVA_ARGS #589

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

Draft
wants to merge 4 commits into
base: ubi9
Choose a base branch
from
Draft
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
4 changes: 0 additions & 4 deletions modules/maven/s2i/artifacts/s2i/maven-s2i
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion modules/run/artifacts/run-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
8 changes: 8 additions & 0 deletions modules/run/tests/features/java.runtime.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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$
10 changes: 1 addition & 9 deletions modules/s2i/bash/artifacts/local/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions modules/s2i/bash/tests/features/run.feature
Original file line number Diff line number Diff line change
@@ -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
Loading