Skip to content

Commit

Permalink
Merge branch 'jlink-dev' into OPENJKD-3052-jlink-builder-tag-template
Browse files Browse the repository at this point in the history
  • Loading branch information
jmtd authored Dec 4, 2024
2 parents 5222576 + 6548e31 commit 023a905
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 26 deletions.
1 change: 0 additions & 1 deletion modules/jdk/11/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ envs:
packages:
install:
- java-11-openjdk-devel
- java-11-openjdk-jmods
- tzdata-java

modules:
Expand Down
1 change: 0 additions & 1 deletion modules/jdk/17/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ envs:
packages:
install:
- java-17-openjdk-devel
- java-17-openjdk-jmods

modules:
install:
Expand Down
1 change: 0 additions & 1 deletion modules/jdk/21/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ envs:
packages:
install:
- java-21-openjdk-devel
- java-21-openjdk-jmods

modules:
install:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
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?
Expand Down
9 changes: 4 additions & 5 deletions modules/jlink/tests/features/jlink.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
@ubi9/openjdk-11
@ubi9/openjdk-17
@ubi9/openjdk-21
Feature: Openshift OpenJDK S2I tests (jlink specific)
Scenario: Ensure jlinked builder is used to build the containerized application image
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i

Scenario: tech preview warning is printed (OPENJDK-3038)
Given failing s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target using master
| variable | value |
| S2I_ENABLE_JLINK | true |
| QUARKUS_PACKAGE_TYPE| uber-jar |
Then run ls /tmp/jre in container and check its output for bin
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/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i
Expand Down
1 change: 1 addition & 0 deletions modules/s2i/bash/artifacts/usr/local/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ setup_java_app_and_lib
if [ "$S2I_ENABLE_JLINK" = "true" ]; then

source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/preflight.sh"
jlink_techpreview_warning
jlink_preflight_check

source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh"
Expand Down
2 changes: 2 additions & 0 deletions templates/jlink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ Some suitable test values for the parameters are
* APP_URI: https://github.com/jboss-container-images/openjdk-test-applications
* REF: master
* CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar
* APPNAME: quarkus-quickstart

oc process \
-p JDK_VERSION=17 \
-p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \
-p REF=master \
-p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \
-p APPNAME=quarkus-quickstart \
templates/jlink-app-template \
| oc create -f -

Expand Down
38 changes: 20 additions & 18 deletions templates/jlink/jlinked-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ parameters:
- description: OpenJDK builder image version tag
name: BUILDER_IMAGE_TAG
value: "latest"
- description: A name for the application used to ensure created resources are uniquely named
name: APPNAME
required: true
- description: Application to run the jlink workflow on
name: APP_URI
Expand All @@ -39,7 +41,7 @@ objects:
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: ubi9-openjdk-${JDK_VERSION}-jlink
name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink
spec:
lookupPolicy:
local: false
Expand All @@ -48,9 +50,9 @@ objects:
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: jlink-builder-jdk-${JDK_VERSION}
name: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION}
labels:
app: jlink-builder-jdk-${JDK_VERSION}
app: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION}
spec:
source:
dockerfile: |
Expand All @@ -76,7 +78,7 @@ objects:
output:
to:
kind: ImageStreamTag
name: ubi9-openjdk-${JDK_VERSION}-jlink:latest
name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest
triggers:
- type: ConfigChange
- type: ImageChange
Expand All @@ -89,7 +91,7 @@ objects:
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: intermediate
name: ${APPNAME}-intermediate
spec:
lookupPolicy:
local: false
Expand All @@ -98,9 +100,9 @@ objects:
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: jlink-s2i-jdk-${JDK_VERSION}
name: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION}
labels:
app: jlink-s2i-jdk-${JDK_VERSION}
app: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION}
spec:
source:
type: Git
Expand All @@ -112,7 +114,7 @@ objects:
sourceStrategy:
from:
kind: ImageStreamTag
name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream from stage-1
name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream from stage-1
pullPolicy: Always
env:
- name: S2I_ENABLE_JLINK
Expand All @@ -122,14 +124,14 @@ objects:
output:
to:
kind: ImageStreamTag
name: intermediate:latest
name: ${APPNAME}-intermediate:latest
triggers:
- type: ConfigChange
- type: ImageChange
imageChange:
from:
kind: ImageStreamTag
name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2
name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2
- type: GitHub
github:
secret: ${GITHUB_WEBHOOK_SECRET}
Expand All @@ -139,7 +141,7 @@ objects:
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: ubimicro
name: ${APPNAME}-ubimicro
spec:
lookupPolicy:
local: true
Expand All @@ -155,7 +157,7 @@ objects:
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: lightweight-image
name: ${APPNAME}-lightweight-image
spec:
lookupPolicy:
local: false
Expand All @@ -164,13 +166,13 @@ objects:
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: multistage-buildconfig
name: ${APPNAME}-multistage-buildconfig
spec:
source:
images:
- from:
kind: ImageStreamTag
name: intermediate:latest
name: ${APPNAME}-intermediate:latest
paths:
- sourcePath: /mnt/jrootfs
destinationDir: jrootfs
Expand Down Expand Up @@ -200,20 +202,20 @@ objects:
dockerStrategy:
from:
kind: ImageStreamTag
name: ubimicro:latest
name: ${APPNAME}-ubimicro:latest
output:
to:
kind: ImageStreamTag
name: lightweight-image:latest # Tag for the final output image
name: ${APPNAME}-lightweight-image:latest # Tag for the final output image
triggers:
- type: ConfigChange
- type: ImageChange
imageChange:
from:
kind: ImageStreamTag
name: intermediate:latest # output of stage-2
name: ${APPNAME}-intermediate:latest # output of stage-2
- type: ImageChange
imageChange:
from:
kind: ImageStreamTag
name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro
name: ${APPNAME}-ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro

0 comments on commit 023a905

Please sign in to comment.