Skip to content

Commit 0681d5f

Browse files
committed
Merge remote-tracking branch 'upstream/jlink-dev' into jlink-stage-1
2 parents e702815 + d2a5290 commit 0681d5f

File tree

6 files changed

+507
-14
lines changed

6 files changed

+507
-14
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
jlink_preflight_check()
2+
{
3+
# preflight check: do we have what we need?
4+
if [ "$JAVA_VERSION" -lt 11 ]; then
5+
echo "Jlink integration not available for JDK${JAVA_VERSION}!"
6+
echo "Jlink integration is only supported for JDK versions 11 and newer."
7+
exit 1
8+
fi
9+
if [ ! -d /usr/lib/jvm/java/jmods ]; then
10+
echo "Jlink integration requires the jmods RPM to be installed in the builder image, e.g."
11+
echo " microdnf install -y java-${JAVA_VERSION}-openjdk-jmods"
12+
exit 1
13+
fi
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@ubi9/openjdk-11
2+
@ubi9/openjdk-17
3+
@ubi9/openjdk-21
4+
Feature: Openshift OpenJDK S2I tests (jlink specific)
5+
Scenario: Ensure jlinked builder is used to build the containerized application image
6+
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i
7+
| variable | value |
8+
| S2I_ENABLE_JLINK | true |
9+
| QUARKUS_PACKAGE_TYPE| uber-jar |
10+
Then run ls /tmp/jre in container and check its output for bin
11+
12+
Scenario: Ensure S2I_ENABLE_JLINK is not set to true
13+
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i
14+
Then container log should not contain S2I_ENABLE_JLINK=true
15+
And run bash -c "test ! -d /tmp/jre && echo PASS" in container and immediately check its output for PASS

modules/run/module.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ modules:
5959
- name: jboss.container.user
6060
- name: jboss.container.java.jvm
6161
- name: jboss.container.util.logging
62+
- name: jboss.container.util.pathfinder

modules/s2i/bash/artifacts/usr/local/s2i/assemble

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,28 @@ maven_s2i_build
1616

1717
# run the pathfinder scripts to define JAVA_APP_JAR and JAVA_LIB_DIR
1818
source "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh"
19-
echo "Setting up java app and lib variables"
2019
setup_java_app_and_lib
2120

2221
# include our jlink scripts
23-
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh"
24-
echo "Invoking mkdeps"
25-
generate_deps
22+
if [ "$S2I_ENABLE_JLINK" = "true" ]; then
2623

27-
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkstrippeddeps.sh"
28-
echo "Stripping dependencies"
29-
mkstrippeddeps
24+
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/preflight.sh"
25+
jlink_preflight_check
3026

31-
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/generatejdkdeps.sh"
32-
echo "Generating JDK dependencies"
33-
generatejdkdeps
27+
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh"
28+
echo "Invoking mkdeps"
29+
generate_deps
3430

35-
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkjreimage.sh"
36-
echo "Linking jre"
37-
generate_jre_image
31+
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkstrippeddeps.sh"
32+
echo "Stripping dependencies"
33+
mkstrippeddeps
34+
35+
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/generatejdkdeps.sh"
36+
echo "Generating JDK dependencies"
37+
generatejdkdeps
38+
39+
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkjreimage.sh"
40+
echo "Linking jre"
41+
generate_jre_image
42+
43+
fi

modules/s2i/core/module.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ envs:
116116
description: ^
117117
Enables the Jdeps/JLink workflow to minimize JRE size
118118
example: "false"
119-
value: "false"
120119

121120
run:
122121
cmd:

0 commit comments

Comments
 (0)