Skip to content

Commit d2649b3

Browse files
authored
Merge pull request #366 from chsc-1/patch-1
[OPENJDK-2033] OpenJDK runtime images cannot overwrite JAVA_APP_DIR
2 parents 5ce7241 + 223e5ef commit d2649b3

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/sh
22

3-
# Set the application dir to the S2I deployment dir
4-
JAVA_APP_DIR=/deployments
3+
# Default the application dir to the S2I deployment dir
4+
if [ -z "$JAVA_APP_DIR" ]
5+
then JAVA_APP_DIR=/deployments
6+
fi

modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ startup() {
245245
procname="${JAVA_APP_NAME-java}"
246246

247247
log_info "exec -a \"${procname}\" java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
248+
log_info "running in $PWD"
248249
exec -a "${procname}" java $(get_java_options) -cp "$(get_classpath)" ${args} $*
249250
}
250251

tests/features/java/runtime.feature

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,29 @@ Feature: Openshift OpenJDK Runtime tests
6767
| JAVA_OPTIONS | --show-version |
6868
Then container log should not contain -XX:MaxRAMPercentage
6969
And container log should contain --show-version
70+
71+
@ubi8
72+
Scenario: Check default JAVA_APP_DIR (OPENJDK-2033)
73+
When container is ready
74+
Then available container log should contain INFO running in /deployments
75+
76+
@ubi8
77+
Scenario: Check custom JAVA_APP_DIR (OPENJDK-2033)
78+
Given container is started with env
79+
| variable | value |
80+
| JAVA_APP_DIR | /home/jboss |
81+
Then available container log should contain INFO running in /home/jboss
82+
83+
@ubi8
84+
Scenario: Check relative path JAVA_APP_DIR (OPENJDK-2033)
85+
Given container is started with env
86+
| variable | value |
87+
| JAVA_APP_DIR | . |
88+
Then available container log should contain INFO running in /home/jboss
89+
90+
@ubi8
91+
Scenario: Check non-existent path JAVA_APP_DIR (OPENJDK-2033)
92+
Given container is started with env
93+
| variable | value |
94+
| JAVA_APP_DIR | /nope |
95+
Then available container log should contain ERROR No directory /nope found for auto detection

0 commit comments

Comments
 (0)