Skip to content

Commit 4484d07

Browse files
authored
Merge pull request #382 from chsc-1/patch-2
[OPENJDK-2034] OpenJDK runtime images cannot overwrite JAVA_APP_DIR (ubi9)
2 parents a8e23e8 + 609d67e commit 4484d07

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed
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

Diff for: modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ startup() {
215215
procname="${JAVA_APP_NAME-java}"
216216

217217
log_info "exec -a \"${procname}\" java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
218+
log_info "running in $PWD"
218219
exec -a "${procname}" java $(get_java_options) -cp "$(get_classpath)" ${args} $*
219220
}
220221

Diff for: tests/features/java/runtime.feature

+26
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,29 @@ Feature: Openshift OpenJDK Runtime tests
4141
| variable | value |
4242
| JAVA_APP_NAME | foo bar |
4343
Then container log should not contain exec: bar': not found
44+
45+
@ubi9
46+
Scenario: Check default JAVA_APP_DIR (OPENJDK-2033)
47+
When container is ready
48+
Then available container log should contain INFO running in /deployments
49+
50+
@ubi9
51+
Scenario: Check custom JAVA_APP_DIR (OPENJDK-2033)
52+
Given container is started with env
53+
| variable | value |
54+
| JAVA_APP_DIR | /home/default |
55+
Then available container log should contain INFO running in /home/default
56+
57+
@ubi9
58+
Scenario: Check relative path JAVA_APP_DIR (OPENJDK-2033)
59+
Given container is started with env
60+
| variable | value |
61+
| JAVA_APP_DIR | . |
62+
Then available container log should contain INFO running in /home/default
63+
64+
@ubi9
65+
Scenario: Check non-existent path JAVA_APP_DIR (OPENJDK-2033)
66+
Given container is started with env
67+
| variable | value |
68+
| JAVA_APP_DIR | /nope |
69+
Then available container log should contain ERROR No directory /nope found for auto detection

0 commit comments

Comments
 (0)