Skip to content

[OPENJDK-4002] merge down jlink-dev branch (take 2) #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 192 commits into
base: ubi9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
4967f2c
Extend GHA to push images that pass tests
jmtd Aug 4, 2023
0489ff7
label images with opencontainers 'source' label
jmtd Aug 7, 2023
072aea8
Add dockerfile to do a multi-stage build for jlink JRE light weight c…
jhuttana Sep 11, 2023
ba6fb98
Merge pull request #393 from jhuttana/multi-stage-jlink-dev
jmtd Sep 12, 2023
c7c1e23
Tweak run-java.sh script for some env varibales and fold run-env.sh i…
jhuttana Sep 14, 2023
988aa56
Address review comments
jhuttana Sep 14, 2023
5bd8fee
Use substring expansion to set the value for JBOSS_CONTAINER_UTIL_LOG…
jhuttana Sep 14, 2023
54a86a3
Change GHA runners to ubuntu-latest
jmtd Sep 15, 2023
d6765e3
Address review comments for indentation and removing unwanted comment…
jhuttana Sep 20, 2023
56f8b60
Merge pull request #397 from jhuttana/clean-up-run-script
jmtd Sep 20, 2023
df3c535
Modify Dockerfile to consolidate destination path for image scripts a…
jhuttana Sep 21, 2023
02aa162
Merge pull request #402 from jhuttana/consolidate_script_path
jmtd Sep 22, 2023
4ff6857
Update tests to refer new application source repository
jhuttana Oct 11, 2023
e5d5361
Update URI to refer new repo for application sources from:
jhuttana Oct 11, 2023
12d0bf7
Update new applicaiton sources URI in the test case
jhuttana Oct 11, 2023
e6f2d81
Address review comment to correct URI in the Given section
jhuttana Oct 25, 2023
f1feb34
Correct the 'Given' section in tests to match s2i build scenarios
jhuttana Nov 6, 2023
490fbd1
Update URI to master repo in the Given section
jhuttana Nov 8, 2023
b702622
Merge pull request #405 from jhuttana/update_application_source_uri
jmtd Nov 8, 2023
b8de112
Merge remote-tracking branch 'Josh-Matsuoka/ubi9-jlink' into jlink-dev
jmtd Dec 13, 2023
f8143c2
Merge commit '4bc78f0475338e0faecc904bcd957d9cf88f8e8e' into jlink-dev
jmtd Dec 13, 2023
06867b4
Tidy up integration of run-java/pathfinder modules
jmtd Dec 13, 2023
53c0347
README for jlink template directory
jmtd Dec 15, 2023
6b632d0
Merge pull request #426 from jmtd/jlink-dev-readme
jmtd Dec 15, 2023
a31fbaf
measure.sh: script to measure image sizes
jmtd Jan 17, 2024
bee0739
measure: Ensure S2I_ENABLE_JLINK is enabled for phase 2
jmtd Jan 18, 2024
17af50a
measure.sh: match intermediate output name to Dockerfile
jmtd Jan 18, 2024
42a504c
Add JDK21 jmods RPM to builder image
jmtd Jan 24, 2024
c0e8b65
Merge pull request #439 from jmtd/jdk21
jmtd Jan 25, 2024
a11fcef
Clean up templates/jlink/Dockerfile
jmtd Jan 30, 2024
cb88c09
templates/jlink/Dockerfile: only microdnf, non-root user
jmtd Jan 30, 2024
540267d
use MAVEN_CLEAR_REPO for baseline S2I build
jmtd Jan 30, 2024
7afeac6
Merge pull request #435 from jmtd/measure.sh
jmtd Jan 30, 2024
8f447c7
Merge pull request #441 from jmtd/jlink-dockerfile-improvements
jmtd Jan 31, 2024
5f28ed9
Quote 'false' to force string type in YAML.
jmtd Feb 22, 2024
acf0162
Remove debug echo
jmtd Feb 22, 2024
8c50624
[OPENJDK-2737] gate jlink calls behind S2I_ENABLE_JLINK
jmtd Feb 22, 2024
d55145b
[OPENJDK-2736] jlink pre-flight check for jmods
jmtd Feb 22, 2024
66f164a
Behave test for jlink integration code
jhuttana Feb 22, 2024
7112369
Address review comments
jhuttana Feb 26, 2024
51923e2
[OPENJDK-2806] Remove value for S2I_ENABLE_JLINK
jmtd Feb 27, 2024
b806996
Initial dockerfiles and buildconfigs for JDK11, 17, 21. TODO: Script …
Josh-Matsuoka Feb 28, 2024
ab4c425
Remove dockerfiles, fix 17 buildconfig, add imagestream creation script
Josh-Matsuoka Feb 28, 2024
7aa28f4
run module: depend upon pathfinder module
jmtd Feb 28, 2024
a2ade6d
Merge pull request #453 from jmtd/OPENJDK-2806-s2i-enable-jlink-conf-var
jmtd Feb 29, 2024
ab2077c
Address review comments for S2I_ENABLE_JLINK configuration variable
jhuttana Feb 29, 2024
26c28b3
Merge pull request #455 from jmtd/OPENJDK-2810-run-pathfinder
jmtd Mar 1, 2024
897a419
[OPENJDK-2736] actually fail in preflight if conditions aren't met
jmtd Mar 1, 2024
2c30d2e
Address review comment to tweak the seach string in behave test
jhuttana Mar 1, 2024
0ddc10b
Merge pull request #449 from jboss-container-images/OPENJDK-2736-jlin…
jmtd Mar 4, 2024
1bedb62
jlink.feature: Adjust method for testing a directory doesn't exist
jmtd Mar 4, 2024
c95b2ef
Merge pull request #450 from jhuttana/jlinkcode_integration
jmtd Mar 4, 2024
b9bdbf3
[OPENJDK-2182] UBI9 image streams for jlink-dev
jmtd Mar 5, 2024
d2a5290
Merge pull request #456 from jmtd/OPENJDK-2812-ubi9-imagestreams
jmtd Mar 6, 2024
e702815
Addressing review feedback
Josh-Matsuoka Mar 13, 2024
0681d5f
Merge remote-tracking branch 'upstream/jlink-dev' into jlink-stage-1
Josh-Matsuoka Mar 13, 2024
4f38d38
Adding Imagestream definition to buildconfig
Josh-Matsuoka Mar 13, 2024
47e70e9
Pulling builder image from new ubi9 imagestreams
Josh-Matsuoka Mar 20, 2024
612d017
Rework buildconfigs into a template, add a readme with instructions.
Josh-Matsuoka Mar 20, 2024
6eba225
README.md: indent code lines, remove ref to namespaces
jmtd Mar 20, 2024
230f94d
jlink-builder-template: remove some keys that will be autopopulated
jmtd Mar 20, 2024
fc7258d
jlink README: remove references to namespaces, prereq + ubi9 images
jmtd Mar 20, 2024
262e386
jlink-builder-template: remove generation: 1
jmtd Mar 20, 2024
ae07f04
jlink-builder-template: move parameters above objects
jmtd Mar 20, 2024
c540151
Merge pull request #454 from Josh-Matsuoka/jlink-stage-1
jmtd Mar 20, 2024
5576f04
Make suitable modifications to Dockerfile for 3-phase build template
jhuttana Mar 27, 2024
22bda43
Add buildConfig to get a template for multistage-build
jhuttana Mar 27, 2024
fa066b7
Pull in the further changes
jhuttana Apr 1, 2024
ad2fe97
Move grep and gawk installation to phase-1
jhuttana Apr 2, 2024
e80dbc2
Address review comments
jhuttana Apr 2, 2024
724f549
Address review comments for jmods rpm
jhuttana Apr 2, 2024
a859973
Merge pull request #472 from jhuttana/phase-1-update
jmtd Apr 2, 2024
39c2f5e
Uncomment jrootfs lines and undo the changes to Dockerfile
jhuttana Apr 3, 2024
29fa4d4
Stage 2 initial implementation
Josh-Matsuoka Apr 4, 2024
7d669fb
stage2: Add an intermediate ImageStream and output to it
jmtd Apr 4, 2024
0970d20
stage2: fix indentation and quote "true"
jmtd Apr 4, 2024
904e4b9
Copy only the contents of jrootfs
jhuttana Apr 4, 2024
bd80d12
Merge pull request #474 from Josh-Matsuoka/jlink-stage-2
jmtd Apr 4, 2024
061dd82
Add imageStream needed for ubi-micro [OPENJDK-2896]
jhuttana Apr 5, 2024
22233e0
Merge pull request #471 from jhuttana/phase-4
jmtd Apr 5, 2024
d34ca87
Merge all 3-templates into one
jhuttana Apr 8, 2024
bc76f73
Address review comments
jhuttana Apr 8, 2024
df69487
Delete jlink-builder-template.yaml and multistage-dockerfile-buildcon…
jhuttana Apr 8, 2024
6007bd4
Delete multistage docker build sources from templates/jlink/ and also…
jhuttana Apr 10, 2024
a903061
Merge pull request #477 from jhuttana/OPENJDK-2911
jmtd Apr 12, 2024
60b9820
[OPENJDK-2897] Refresh jlink README
jmtd Apr 12, 2024
60cffc2
Describe configuring Docker to avoid TLS verifying OCP registry
jmtd Apr 16, 2024
7f7450c
Merge pull request #481 from jmtd/OPENJDK-2897-jlink-README
jmtd Apr 16, 2024
b29d66b
Update jlink README with final steps
jmtd Apr 25, 2024
8a04730
Add hooks to trigger stage-1 build
jhuttana Apr 29, 2024
f36bae7
Merge pull request #488 from jhuttana/stage-1-hook
jmtd Apr 29, 2024
021931f
Add hooks for stage-2 build
jhuttana Apr 29, 2024
a231afc
Address review comments to genereat random secret value
jhuttana Apr 30, 2024
1c9bc41
Merge pull request #489 from jhuttana/stage-2-hooks
jmtd Apr 30, 2024
2f70a22
Update jlink README to reflect new triggers
jmtd Apr 30, 2024
f125b75
Add a guard check in Dockerfile for presence of jlink scripts
jhuttana May 22, 2024
479ecad
silence guard check on success branch
jmtd May 30, 2024
9139fa2
Merge pull request #495 from jhuttana/add_guard_check
jmtd May 30, 2024
c6b5fb1
Spec for deployment and route object
jhuttana Jun 10, 2024
1ceccb7
Correct apiVersion for deployment object
jhuttana Jun 10, 2024
60d1b9e
Change the image value to lightweight-image and also add imagePullPolicy
jhuttana Jun 10, 2024
f039a32
Add template parameter to ensure created objects
Josh-Matsuoka Jul 4, 2024
7eecfc6
Add missing ubimicro prefixes
Josh-Matsuoka Oct 16, 2024
5222576
[OPENJDK-3052] parameterize builder image tag
jmtd Oct 18, 2024
e1dea2b
Don't run this test on JDK11 (EOL)
jmtd Oct 21, 2024
7061b8e
Remove jmods rpm from builder images
Josh-Matsuoka Oct 21, 2024
8b8bce8
Add example APPNAME to README
Josh-Matsuoka Oct 21, 2024
77278c5
Merge pull request #508 from jmtd/jlink-jdk11
jmtd Oct 22, 2024
982598d
Merge pull request #509 from Josh-Matsuoka/jmods-rpm-removal
jmtd Oct 22, 2024
3dd45b2
Merge pull request #502 from Josh-Matsuoka/unique-names
jmtd Oct 22, 2024
464fcdc
Merge jaya changes
Josh-Matsuoka Oct 29, 2024
587d1f3
Rename created objects to follow unique naming convention
Josh-Matsuoka Nov 5, 2024
5af22fd
Convert to DeploymentConfig, cleanup
Josh-Matsuoka Nov 6, 2024
040ddca
Fix deploymentconfig
Josh-Matsuoka Nov 6, 2024
8d6cfea
Add ports to readme, fix Service
Josh-Matsuoka Nov 19, 2024
4f67aa3
[OPENJDK-3038] echo out Tech Preview warning
jmtd Nov 26, 2024
6548e31
Merge pull request #527 from jmtd/OPENJDK-3038-tech-preview
jmtd Dec 4, 2024
023a905
Merge branch 'jlink-dev' into OPENJKD-3052-jlink-builder-tag-template
jmtd Dec 4, 2024
d0cf783
Merge pull request #507 from jmtd/OPENJKD-3052-jlink-builder-tag-temp…
jmtd Dec 4, 2024
d747bc3
Add pod to template
Josh-Matsuoka Dec 18, 2024
adb47cc
Add new label to each created object to allow for easy filtering
Josh-Matsuoka Dec 18, 2024
b46af7a
Fix labels
Josh-Matsuoka Dec 18, 2024
a88ad3d
[OPENJDK-3540] component & dist-git branch for tech-preview image
jmtd Jan 20, 2025
1a4bbe4
Add jmods rpm back into the UBI9/JDK21 image
Josh-Matsuoka Jan 20, 2025
9c94e84
Rename ubi9/openjdk21 images to reflect tech preview
Josh-Matsuoka Jan 20, 2025
4e589a8
Ensure the build fails when jdeps fails
Josh-Matsuoka Jan 20, 2025
011fd65
Merge pull request #535 from Josh-Matsuoka/jmods-rpm
jmtd Jan 21, 2025
d89c568
Address review feedback
Josh-Matsuoka Jan 21, 2025
c47a6bb
Address review feedback 2
Josh-Matsuoka Jan 21, 2025
e29e89f
Merge pull request #534 from jmtd/OPENJDK-3540-TP-dist-git
jmtd Jan 22, 2025
a6b6936
Review feedback 3
Josh-Matsuoka Jan 22, 2025
090f253
Merge pull request #536 from Josh-Matsuoka/rename-ubi9-jdk21
jmtd Jan 23, 2025
b74f064
Merge remote-tracking branch 'upstream2/jlink-dev' into error-handling
Josh-Matsuoka Jan 24, 2025
5f04691
Fix return code handling
Josh-Matsuoka Jan 28, 2025
4cc46dc
Add consistent label to all created objects
Josh-Matsuoka Jan 28, 2025
8da7558
Merge pull request #541 from Josh-Matsuoka/consistent-label
jmtd Jan 29, 2025
1281267
Merge pull request #537 from Josh-Matsuoka/error-handling
jmtd Jan 29, 2025
58e62dc
Merge remote-tracking branch 'upstream2/jlink-dev' into jaya-cleanup
Josh-Matsuoka Jan 29, 2025
884c621
Rename ubi9 references to reflect tech preview
Josh-Matsuoka Jan 29, 2025
b45009c
revert image tag to latest
Josh-Matsuoka Feb 4, 2025
f48ffa2
use builder image tag parameter
Josh-Matsuoka Feb 4, 2025
6a4fcb5
Update README to reflect new naming conventions and builds automatica…
Josh-Matsuoka Feb 18, 2025
cc93f0e
Update README and template to reflect tech-preview status
Josh-Matsuoka Feb 18, 2025
d38995e
Add test to check that /tmp/jre exists when jlink is enabled
Josh-Matsuoka Feb 18, 2025
6a8f07b
Update test application
Josh-Matsuoka Feb 18, 2025
29f7c36
Update README for appname parameter and docker tags
Josh-Matsuoka Feb 18, 2025
de61bdb
Merge pull request #553 from Josh-Matsuoka/3647
jmtd Feb 19, 2025
a94e58b
Merge pull request #551 from Josh-Matsuoka/README-updates
jmtd Feb 19, 2025
94033a7
Merge remote-tracking branch 'upstream2/jlink-dev' into jaya-cleanup
Josh-Matsuoka Feb 26, 2025
9dce767
Update README with warning about projects, convert DeploymentConfig t…
Josh-Matsuoka Feb 26, 2025
b566af7
Fix imagestream name, docker commands
Josh-Matsuoka Feb 26, 2025
7793e2a
README fixes
Josh-Matsuoka Feb 28, 2025
4a65195
Merge changes from upstream
Josh-Matsuoka Feb 28, 2025
8e77d86
Merge pull request #552 from Josh-Matsuoka/3634
Josh-Matsuoka Feb 28, 2025
b474239
Merge changes from upstream
Josh-Matsuoka Mar 1, 2025
06a2d7f
Merge pull request #514 from Josh-Matsuoka/jaya-cleanup
jmtd Mar 3, 2025
3af343e
Merge remote-tracking branch 'origin/ubi9' into 3591-merge-back-jlink
jmtd Feb 19, 2025
7e16de1
Merge pull request #556 from jmtd/3591-merge-back-jlink
jmtd Mar 4, 2025
31708a3
[OPENJDK-3647] adjust jlink Behave tests
jmtd Mar 4, 2025
0b86528
Remove jmods rpm installation from stage 1
Josh-Matsuoka Mar 4, 2025
4563d8e
Create temporary jlink files under /tmp/jlink, clean up based on S2I_…
Josh-Matsuoka Mar 4, 2025
dd54f04
Correct delete source check to use variable rather than hardcoded path
Josh-Matsuoka Mar 4, 2025
a4f482b
[OPENJDK-3683] revert change to GHA image name
jmtd Mar 5, 2025
132b5d8
Merge pull request #565 from Josh-Matsuoka/3645
jmtd Mar 5, 2025
3a410cb
Merge pull request #564 from jmtd/3647-adjust-tests
jmtd Mar 5, 2025
643a79c
Merge pull request #568 from jmtd/3683-gha-fix-filename
jmtd Mar 5, 2025
ccfa477
Address review feedback
Josh-Matsuoka Mar 5, 2025
4dd243a
Merge remote-tracking branch 'upstream2/jlink-dev' into 3646
Josh-Matsuoka Mar 5, 2025
4ddcde6
Add behave test
Josh-Matsuoka Mar 5, 2025
ec538a0
Add second behave test
Josh-Matsuoka Mar 6, 2025
6d8bb45
Merge pull request #566 from Josh-Matsuoka/3646
jmtd Mar 7, 2025
d0125f3
Revert "Extend GHA to push images that pass tests"
jmtd Mar 7, 2025
eb7ecbd
Merge pull request #569 from jmtd/3680-drop-gha-stuff
jmtd Mar 8, 2025
37c1153
Remove measure.sh
Josh-Matsuoka Mar 11, 2025
6fc07ed
Correct org.opencontainers.image.source
Josh-Matsuoka Mar 11, 2025
40f75ef
Merge pull request #570 from Josh-Matsuoka/3681
jmtd Mar 11, 2025
44e726e
Merge pull request #571 from Josh-Matsuoka/3682
jmtd Mar 11, 2025
c7064af
Merge remote-tracking branch 'origin/ubi9' into align-versions
jmtd Mar 25, 2025
d4479a7
Merge pull request #574 from jmtd/align-versions
jmtd Mar 25, 2025
9ab88ac
[OPENJDK-3686] update jlink README with RHEC link, customer focus
jmtd Apr 9, 2025
406b3b7
Update the example APP_URI and CONTEXT_DIR
jmtd Apr 15, 2025
917c545
Update README.md: suggest pulling TP image
jmtd Apr 22, 2025
605bf89
Update README.md: fix list syntax
jmtd Apr 22, 2025
772179b
Merge pull request #578 from jmtd/jlink-update-test-repo
jmtd Apr 29, 2025
c5f2d6f
Merge branch 'jlink-dev' into jlink-README-RHEC
jmtd Apr 29, 2025
ef76045
Merge pull request #575 from jmtd/jlink-README-RHEC
jmtd Apr 29, 2025
879b892
Merge remote-tracking branch 'origin/ubi9' into jlink-dev
jmtd Jul 23, 2025
e54b044
restore JDK21 tags to tests
jmtd Jul 23, 2025
4bc0ae3
Split jlink TP into separate image descriptor
jmtd Jul 23, 2025
e3b93d3
Remove jlink-specific changes to common modules
jmtd Jul 23, 2025
e3ee123
Merge remote-tracking branch 'origin/ubi9' into jlink-dev
jmtd Aug 5, 2025
e4d595c
Update pathfinder install to set sensible permissions
jmtd Aug 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

function generatejdkdeps() {
echo "Generating JDK deps"
$JAVA_HOME/bin/java --list-modules > $S2I_JLINK_TEMP_PATH/java-modules.txt
< $S2I_JLINK_TEMP_PATH/java-modules.txt sed "s/\\@.*//" > $S2I_JLINK_TEMP_PATH/modules.txt
grep -Fx -f $S2I_JLINK_TEMP_PATH/stripped-deps.txt $S2I_JLINK_TEMP_PATH/modules.txt | tr '\n' ',' | tr -d "[:space:]" > $S2I_JLINK_TEMP_PATH/module-deps.txt
echo "jdk.zipfs" >> $S2I_JLINK_TEMP_PATH/module-deps.txt
}
32 changes: 32 additions & 0 deletions modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail
shopt -s globstar

function generate_deps() {
# Create a temporary directory for a module path
# This works around "Module java.xml.bind not found, required by java.ws.rs"
mkdir dependencies

if [[ -v JAVA_LIB_DIR ]]; then
# Serially copy all library JARsinto a flat directory. Serially as we may
# have multiple libs with the same name; in which case, we clobber all but
# one rather than fail the script
find $JAVA_LIB_DIR -type f -name '*.jar' -exec cp -vt dependencies {} \;

echo "Working with: "
echo $JAVA_APP_JAR
echo $JAVA_LIB_DIR
# generate the dependency list
$JAVA_HOME/bin/jdeps --multi-release $JAVA_VERSION -R -s \
--module-path dependencies \
"$JAVA_APP_JAR" \
"$JAVA_LIB_DIR"/**/*.jar \
> $S2I_JLINK_TEMP_PATH/deps.txt
else
$JAVA_HOME/bin/jdeps --multi-release $JAVA_VERSION -R -s \
--module-path dependencies \
"$JAVA_APP_JAR" \
> $S2I_JLINK_TEMP_PATH/deps.txt
cat $S2I_JLINK_TEMP_PATH/deps.txt
fi
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# TODO: Still Needed?
set -euo pipefail

depsfile="$S2I_JLINK_TEMP_PATH/module-deps.txt"

function generate_jre_image() {
test -f $depsfile
modules="$(cat $depsfile)"

$JAVA_HOME/bin/jlink --output "$S2I_JLINK_OUTPUT_PATH" \
--add-modules "$modules" \
--strip-debug --no-header-files --no-man-pages \
--compress=2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail

function mkstrippeddeps() {
if [ -f "$S2I_JLINK_TEMP_PATH/deps.txt" ]; then
echo "deps exists, filtering"
< $S2I_JLINK_TEMP_PATH/deps.txt \
grep 'java\|jdk\.' | # mostly removes target/, but also jdk8internals
sed -E "s/Warning: .*//" | #remove extraneous warnings
sed -E "s/.*-> //" | # remove src of src -> dep
sed -E "s/.*\.jar//" | # remove extraneous dependencies
sed "s#/.*##" | # delete anything after a slash. in practice target/..
sort | uniq |
tee $S2I_JLINK_TEMP_PATH/stripped-deps.txt
echo "Stripping dependencies complete"
else
echo "deps does not exist"
fi
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
jlink_techpreview_warning()
{
{
echo "WARNING WARNING WARNING"
echo " Jlink integration is a Tech Preview feature!"
echo " See <https://access.redhat.com/support/offerings/techpreview/>"
echo " for more information."
echo "WARNING WARNING WARNING"
} >&2
}

jlink_preflight_check()
{
# preflight check: do we have what we need?
if [ "$JAVA_VERSION" -lt 11 ]; then
echo "Jlink integration not available for JDK${JAVA_VERSION}!"
echo "Jlink integration is only supported for JDK versions 11 and newer."
exit 1
fi
if [ ! -d /usr/lib/jvm/java/jmods ]; then
echo "Jlink integration requires the jmods RPM to be installed in the builder image, e.g."
echo " microdnf install -y java-${JAVA_VERSION}-openjdk-jmods"
exit 1
fi
}
14 changes: 14 additions & 0 deletions modules/jlink/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# Configure module
set -e

SCRIPT_DIR=$(dirname $0)
ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts

chown -R default:root $SCRIPT_DIR
chmod -R ug+rwX $SCRIPT_DIR
chmod ug+x ${ARTIFACTS_DIR}/opt/jboss/container/java/jlink/*

pushd ${ARTIFACTS_DIR}
cp -pr * /
popd
32 changes: 32 additions & 0 deletions modules/jlink/module.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
schema_version: 1

name: "jboss.container.java.jlink"
version: "2.0"
description: ^
"Provides support for building custom JREs with a slimmed
down set of modules by making use of Jdeps and Jlink"

execute:
- script: configure.sh

envs:
- name: JBOSS_CONTAINER_JAVA_JLINK_MODULE
value: /opt/jboss/container/java/jlink
- name: S2I_JLINK_OUTPUT_PATH
value: /tmp/jre
- name: S2I_JLINK_TEMP_PATH
value: /tmp/jlink
- name: S2I_ENABLE_JLINK
description: ^
Enables the Jdeps/JLink workflow to minimize JRE size
example: "false"

modules:
install:
- name: jboss.container.java.run
- name: jboss.container.util.pathfinder

packages:
install:
- binutils # for objcopy
- java-21-openjdk-jmods
36 changes: 36 additions & 0 deletions modules/jlink/tests/features/jlink.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@openjdk-tech-preview/openjdk-21-jlink-rhel9
Feature: Openshift OpenJDK S2I tests (jlink specific)

Scenario: tech preview warning is printed (OPENJDK-3038)
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from spring-boot-sample-simple/target using master
| variable | value |
| S2I_ENABLE_JLINK | true |
Then s2i build log should contain Jlink integration is a Tech Preview feature

Scenario: Ensure S2I_ENABLE_JLINK is not set to true
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from spring-boot-sample-simple/target using master
Then s2i build log should not contain Jlink integration is a Tech Preview feature
And file /tmp/jre should not exist

Scenario: Check that /tmp/jre/bin/java and /tmp/jre/lib/modules exist post s2i build if jlink is enabled.
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar
| variable | value |
| S2I_ENABLE_JLINK | true |
Then file /tmp/jre/bin/java should exist and be a file
And file /tmp/jre/lib/modules should exist and be a file

Scenario: Check that /tmp/jlink is deleted when S2I_DELETE_SOURCE is set
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar
| variable | value |
| S2I_ENABLE_JLINK | true |
| S2I_DELETE_SOURCE | true |
Then s2i build log should contain Cleaning up temporary file directory /tmp/jlink
And file /tmp/jlink should not exist

Scenario: Check that /tmp/jlink is not deleted when S2I_DELETE_SOURCE is set to false
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar
| variable | value |
| S2I_ENABLE_JLINK | true |
| S2I_DELETE_SOURCE | false |
Then s2i build log should not contain Cleaning up temporary file directory /tmp/jlink
And file /tmp/jlink should exist
1 change: 1 addition & 0 deletions modules/jvm/tests/features/memory.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Feature: OPENJDK-559 JVM Memory tests
@ubi9/openjdk-11
@ubi9/openjdk-17
@ubi9/openjdk-21
@openjdk-tech-preview/openjdk-21-jlink-rhel9
Scenario: Ensure Maven doesn't use MaxRAMPercentage=80
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications.git from spring-boot-sample-simple
Then s2i build log should match regex INFO Using MAVEN_OPTS.*-XX:MaxRAMPercentage=25.0$
1 change: 1 addition & 0 deletions modules/jvm/tests/features/runtime.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@ubi9/openjdk-11
@ubi9/openjdk-17
@ubi9/openjdk-21
@openjdk-tech-preview/openjdk-21-jlink-rhel9
Feature: Openshift OpenJDK Runtime tests

@ubi9
Expand Down
1 change: 1 addition & 0 deletions modules/maven/s2i/tests/features/java_s2i.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@ubi9/openjdk-11
@ubi9/openjdk-17
@ubi9/openjdk-21
@openjdk-tech-preview/openjdk-21-jlink-rhel9
Feature: Openshift OpenJDK S2I tests
# NOTE: these tests should be usable with the other images once we have refactored the JDK scripts.
# These builds do not actually run maven. This is important, because the proxy
Expand Down
1 change: 1 addition & 0 deletions modules/maven/s2i/tests/features/java_s2i_inc.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@ubi9/openjdk-11
@ubi9/openjdk-17
@ubi9/openjdk-21
@openjdk-tech-preview/openjdk-21-jlink-rhel9
Feature: Openshift OpenJDK S2I tests

# test incremental builds
Expand Down
98 changes: 4 additions & 94 deletions modules/run/artifacts/opt/jboss/container/java/run/run-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ set -eo pipefail

export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="${JBOSS_CONTAINER_UTIL_LOGGING_MODULE-/opt/jboss/container/util/logging}"
export JBOSS_CONTAINER_JAVA_RUN_MODULE="${JBOSS_CONTAINER_JAVA_RUN_MODULE-/opt/jboss/container/java/run}"
export JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE="${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE-/opt/jboss/container/util/pathfinder}"

# Default the application dir to the S2I deployment dir
if [ -z "$JAVA_APP_DIR" ]
then JAVA_APP_DIR=/deployments
fi

source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh"
source "$JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE/pathfinder.sh"

# ==========================================================
# Generic run script for running arbitrary Java applications
Expand All @@ -30,99 +32,6 @@ check_error() {
fi
}

# detect Quarkus fast-jar package type (OPENJDK-631)
is_quarkus_fast_jar() {
if test -f quarkus-app/quarkus-run.jar; then
log_info "quarkus fast-jar package type detected"
echo quarkus-app/quarkus-run.jar
return 0
else
return 1
fi
}

# Try hard to find a sane default jar-file
auto_detect_jar_file() {
local dir=$1

# Filter out temporary jars from the shade plugin which start with 'original-'
local old_dir=$(pwd)
cd ${dir}
if [ $? = 0 ]; then

if quarkus="$(is_quarkus_fast_jar)"; then
echo "$quarkus"
return
fi

local nr_jars=`ls *.jar 2>/dev/null | grep -v '^original-' | wc -l | tr -d '[[:space:]]'`
if [ ${nr_jars} = 1 ]; then
ls *.jar | grep -v '^original-'
exit 0
fi

log_error "Neither \$JAVA_MAIN_CLASS nor \$JAVA_APP_JAR is set and ${nr_jars} JARs found in ${dir} (1 expected)"
cd ${old_dir}
else
log_error "No directory ${dir} found for auto detection"
fi
}

# Check directories (arg 2...n) for a jar file (arg 1)
get_jar_file() {
local jar=$1
shift;

if [ "${jar:0:1}" = "/" ]; then
if [ -f "${jar}" ]; then
echo "${jar}"
else
log_error "No such file ${jar}"
fi
else
for dir in $*; do
if [ -f "${dir}/$jar" ]; then
echo "${dir}/$jar"
return
fi
done
log_error "No ${jar} found in $*"
fi
}

load_env() {
# Configuration stuff is read from this file
local run_env_sh="run-env.sh"

# Load default default config
if [ -f "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" ]; then
source "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}"
fi

# Check also $JAVA_APP_DIR. Overrides other defaults
# It's valid to set the app dir in the default script
if [ -f "${JAVA_APP_DIR}/${run_env_sh}" ]; then
source "${JAVA_APP_DIR}/${run_env_sh}"
fi

export JAVA_APP_DIR

# JAVA_LIB_DIR defaults to JAVA_APP_DIR
export JAVA_LIB_DIR="${JAVA_LIB_DIR:-${JAVA_APP_DIR}}"
if [ -z "${JAVA_MAIN_CLASS}" ] && [ -z "${JAVA_APP_JAR}" ]; then
JAVA_APP_JAR="$(auto_detect_jar_file ${JAVA_APP_DIR})"
check_error "${JAVA_APP_JAR}"
fi

if [ "x${JAVA_APP_JAR}" != x ]; then
local jar="$(get_jar_file ${JAVA_APP_JAR} ${JAVA_APP_DIR} ${JAVA_LIB_DIR})"
check_error "${jar}"
export JAVA_APP_JAR=${jar}
else
export JAVA_MAIN_CLASS
fi
}

# Combine all java options
get_java_options() {
local jvm_opts
Expand Down Expand Up @@ -226,7 +135,8 @@ mask_passwords() {
# Start JVM
startup() {
# Initialize environment
load_env
# populates JAVA_APP_JAR and JAVA_LIB_DIR and possibly JAVA_MAIN_CLASS
setup_java_app_and_lib

local args
cd ${JAVA_APP_DIR}
Expand Down
1 change: 1 addition & 0 deletions modules/run/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ modules:
- name: jboss.container.user
- name: jboss.container.java.jvm
- name: jboss.container.util.logging
- name: jboss.container.util.pathfinder
1 change: 1 addition & 0 deletions modules/run/tests/features/java.security.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@ubi9/openjdk-11
@ubi9/openjdk-17
@ubi9/openjdk-21
@openjdk-tech-preview/openjdk-21-jlink-rhel9
Feature: Openshift S2I tests
Scenario: Check networkaddress.cache.negative.ttl has been set correctly
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications.git from binary-cli-security-property
Expand Down
Loading
Loading