jboss-container-images / openjdk

Source To Image (S2I) image for Red Hat OpenShift providing OpenJDK
Apache License 2.0
54 stars 58 forks source link

[OPENJDK-2915] refactor run-env.sh into run-java.sh, clean up run script #478

Closed jmtd closed 5 months ago

jmtd commented 5 months ago

https://issues.redhat.com/browse/OPENJDK-2915

This is some clean-up work that was needed prior to implementing the jlink integration scripts.

The file run-env.sh is shipped alongside run-java.sh in the containers. All it did was to set a default value for JAVA_APP_DIR, if it was not already set.

There is a related feature of the run script: if a run-env.sh script is present within the application dir (JAVA_APP_DIR), then it is evaluated. Therefore an application source can extend the run behaviour with extra shell script.

This clean-up removes the run-env.sh that is shipped alongside run-java.sh, moving what it directly into run-java.sh instead. Via separate PRs, we have added unit test coverage for the behaviours listed above:

  1. Ensure that run-env.sh placed in the JAVA_APP_DIR is sourced in the run script before launching java
  2. test coverage for setting values of JAVA_APP_DIR

This is a port of https://github.com/jboss-container-images/openjdk/pull/397 for the ubi9 branch. I hope to merge this (and another piece) prior to looking at jlink-dev, to reduce the size of the jlink delta and make review easier.

This is @jhuttana 's work.

jhuttana commented 5 months ago

We already have test coverage for this on ubi9 also https://github.com/jboss-container-images/openjdk/blob/ubi9/modules/maven/s2i/tests/features/java_s2i.feature#L178 PR : https://github.com/jboss-container-images/openjdk/pull/412