File tree Expand file tree Collapse file tree 9 files changed +34
-15
lines changed Expand file tree Collapse file tree 9 files changed +34
-15
lines changed Original file line number Diff line number Diff line change 1
1
bazel- *
2
+ .ijwb
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ junit_docker_compose_test(
94
94
test_srcs = glob(["**/*Test.java"]),
95
95
test_deps = ["@maven//:org_junit_jupiter_junit_jupiter_api"],
96
96
classpath_jars = ["@maven//:org_junit_platform_junit_platform_console_standalone"],
97
- test_image_base = "@distroless_java ",
97
+ test_image_base = "@openjdk ",
98
98
)
99
99
```
100
100
Original file line number Diff line number Diff line change 13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
16
+ echo " [DEBUG] JAVA_HOME before discovery logic: $JAVA_HOME "
17
+
16
18
# if JAVA_HOME is not set, just default to /usr (works if /usr/bin/java exists)
17
19
if [[ -z " $JAVA_HOME " ]]; then
18
- JAVA_HOME=" /usr"
20
+ export JAVA_HOME=" /usr"
19
21
# this is used if JAVA_HOME contains an * (if version changes regularly this can be useful)
20
- elif [[ " $JAVA_HOME " == * " \* " * ]] ; then
21
- JAVA_HOME=$( find $JAVA_HOME -maxdepth 1 | head -n 1)
22
+ elif echo " $JAVA_HOME " | grep ' * ' > /dev/null ; then
23
+ export JAVA_HOME=$( find $JAVA_HOME -maxdepth 1 | head -n 1)
22
24
fi
23
25
26
+ echo " [DEBUG] JAVA_HOME after discovery logic: $JAVA_HOME "
27
+ export PATH=$JAVA_HOME /bin:$PATH
28
+ echo " [DEBUG] PATH: $PATH "
29
+
24
30
TEST_UBER_JAR=$( find ./ -maxdepth 1 -name ' *_uber_jar_deploy.jar' )
25
31
JUNIT_PLATFORM_CONSOLE_STANDALONE_JAR=$( find ./ -maxdepth 1 -name ' *junit-platform-console-standalone*.jar' )
26
32
Original file line number Diff line number Diff line change
1
+ common --test_output=errors
2
+ common --verbose_explanations
Original file line number Diff line number Diff line change @@ -50,10 +50,13 @@ oci_register_toolchains(
50
50
load ("@rules_oci//oci:pull.bzl" , "oci_pull" )
51
51
52
52
oci_pull (
53
- name = "distroless_java" ,
54
- # tag = "debug", # debug distroless image can be debugged with --entrypoint "/busybox/sh"
55
- digest = "sha256:73c3687a9d7277f480a560ae380ba16acbe8eb5a0f459560b4466bb71e6288a1" ,
56
- image = "gcr.io/distroless/java17" ,
53
+ name = "openjdk" ,
54
+ digest = "sha256:29c44ad7bb159a29a4458b74e8d37c1995cb8dc32abdd35e6d3e3d493e682d10" ,
55
+ image = "openjdk" ,
56
+ platforms = [
57
+ "linux/amd64" ,
58
+ "linux/arm64/v8" ,
59
+ ],
57
60
)
58
61
59
62
oci_pull (
Original file line number Diff line number Diff line change @@ -22,5 +22,5 @@ junit_docker_compose_test(
22
22
test_srcs = glob (["**/*Test.java" ]),
23
23
test_deps = ["@maven//:org_junit_jupiter_junit_jupiter_api" ],
24
24
classpath_jars = ["@maven//:org_junit_platform_junit_platform_console_standalone" ],
25
- test_image_base = "@distroless_java " ,
25
+ test_image_base = "@openjdk " ,
26
26
)
Original file line number Diff line number Diff line change 18
18
package com .salesforce .rules_docker_compose_test .HelloTest ;
19
19
20
20
import org .junit .jupiter .api .Test ;
21
- import static org . junit . jupiter . api . Assertions . assertTrue ;
21
+ import java . io . IOException ;
22
22
23
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
24
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
23
25
24
26
class HelloTest {
25
27
26
28
@ Test
27
- void helloWorldContainsHello () {
29
+ void helloWorldContainsHello () throws IOException , InterruptedException {
30
+ // Testing that the $JAVA_HOME/bin binaries are available
31
+ ProcessBuilder processBuilder = new ProcessBuilder (new String []{"sh" , "-c" , "jstat --help" });
32
+ Process process = processBuilder .start ();
33
+ int exitValue = process .waitFor ();
34
+ assertEquals (0 , exitValue );
28
35
assertTrue ("Hello World!" .contains ("Hello" ));
29
36
}
30
- }
37
+ }
Original file line number Diff line number Diff line change 16
16
services :
17
17
test_container :
18
18
image : junit-image-test:test_container
19
- entrypoint : ["/busybox/sh ", "./test_container_entrypoint.sh"]
19
+ entrypoint : ["/bin/bash ", "./test_container_entrypoint.sh"]
20
20
environment :
21
- - JAVA_HOME=/usr/
21
+ - JAVA_HOME=/usr/local/openjdk-*
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ pkg_tar(
25
25
26
26
oci_image (
27
27
name = "java_image" ,
28
- base = "@distroless_java " ,
28
+ base = "@openjdk " ,
29
29
tars = [
30
30
":files" ,
31
31
],
You can’t perform that action at this time.
0 commit comments