Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/image-workflow-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest

- name: Install CEKit
uses: cekit/[email protected].5
uses: cekit/[email protected].7

- name: Build
run: |
Expand Down
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ link:https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI[UBI
link:https://access.redhat.com/documentation/en-us/openjdk/17[Red Hat provide
Product documentation for customers]. Tables of environment variables used for
image configuration are published to
<https://jboss-container-images.github.io/openjdk/>. These tables are automatically
<https://rh-openjdk.github.io/redhat-openjdk-containers/>. These tables are automatically
updated for every tagged release, and every commit to the development branches.

Older RHEL7 and RHEL8-based image sources are in the `rhel7` and `ubi8` branches respectively.

## How to build the images

You need to https://cekit.readthedocs.io/en/develop/installation.html[install Cekit] to build these images.
You need to https://docs.cekit.io/en/latest/handbook/installation/index.html[install Cekit] to build these images.

These sources are prepared and tested for Cekit 4.1.1.

Expand Down
5 changes: 3 additions & 2 deletions docs/README.adoc
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Red Hat UBI OpenJDK container images
= Red Hat UBI OpenJDK container images
:toc: right

This is auto-generated documentation for the
link:https://www.redhat.com/en/blog/introducing-red-hat-universal-base-image[Red
Hat Universal Base Image] (UBI) OpenJDK container images.

* link:https://github.com/jboss-container-images/openjdk[container image source repository]
* link:https://rh-openjdk.github.io/redhat-openjdk-containers/[container image source repository]

Container images are available from the
link:https://catalog.redhat.com/software/containers/explore[Red Hat Ecosystem
Expand Down
22 changes: 10 additions & 12 deletions gendocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,16 @@ workdir="$(mktemp -td gendocs.XXXXXX)"
cp ./gendocs.py "$workdir/gendocs.py"
cp ./docs/README.adoc "$workdir/README.adoc"

# documentation for development branches
addToIndex "\n== Development branches ==\n"
for branch in ubi8 ubi9; do
addToIndex "\n=== $branch ===\n"
handleRef "$branch" "$branch"
done

# documentation for tagged releases
addToIndex "\n== Released images =="
for tag in $(git tag -l 'ubi?-openjdk-containers*' | sort -r); do
addToIndex "\n=== $tag ===\n"
handleRef "$tag"
for ubi in ubi9 ubi8; do
UBI=${ubi^^}
addToIndex "\n== $UBI\n"
addToIndex "\n=== development\n"
handleRef "$ubi"
for tag in $(git tag -l "${ubi}-openjdk-containers*" | sort -r); do
version=${tag/${ubi}-openjdk-containers-/}
addToIndex "\n=== $version\n"
handleRef "$tag"
done
done

asciidoctor "$workdir/README.adoc" -o docs/index.html
1 change: 1 addition & 0 deletions modules/jdk/11/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
1 change: 1 addition & 0 deletions modules/jdk/17/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
1 change: 1 addition & 0 deletions modules/jdk/21/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
1 change: 1 addition & 0 deletions modules/jdk/8/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
5 changes: 5 additions & 0 deletions modules/jdk/module.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
schema_version: 1

name: "jboss.container.openjdk"
description: "A dummy descriptor to couple tests with jdk modules"
version: "0"
98 changes: 98 additions & 0 deletions modules/jdk/tests/features/openjdk.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Feature: Miscellaneous OpenJDK-related unit tests

@ubi9/openjdk-11
@ubi9/openjdk-11-runtime
Scenario: Check that only OpenJDK 11 is installed
When container is started with args
| arg | value |
| command | rpm -qa |
Then available container log should not contain java-1.8.0
Then available container log should not contain java-17
Then available container log should not contain java-21

@ubi9/openjdk-17
@ubi9/openjdk-17-runtime
Scenario: Check that only OpenJDK 17 is installed
When container is started with args
| arg | value |
| command | rpm -qa |
Then available container log should not contain java-1.8.0
Then available container log should not contain java-11
Then available container log should not contain java-21

@ubi9/openjdk-21
@ubi9/openjdk-21-runtime
Scenario: Check that only OpenJDK 21 is installed
When container is started with args
| arg | value |
| command | rpm -qa |
Then available container log should not contain java-1.8.0
Then available container log should not contain java-11
Then available container log should not contain java-17

@ubi9
Scenario: Ensure JAVA_HOME is defined and contains Java
When container is started with args
| arg | value |
| command | bash -c "$JAVA_HOME/bin/java -version" |
Then available container log should contain OpenJDK Runtime Environment

@ubi9
Scenario: Check that certain non-UBI packages are not installed
When container is started with args
| arg | value |
| command | rpm -qa |
Then available container log should not contain grub
Then available container log should not contain os-prober
Then available container log should not contain rpm-plugin-systemd-inhibit

@ubi9/openjdk-11
@ubi9/openjdk-11-runtime
Scenario: Check that directories from other JDKs are not present (JDK11)
When container is started with args
| arg | value |
| command | ls -1 /usr/lib/jvm |
Then available container log should not contain java-1.8.0
Then available container log should not contain java-17
Then available container log should not contain java-21

@ubi9/openjdk-17
@ubi9/openjdk-17-runtime
Scenario: Check that directories from other JDKs are not present (JDK17)
When container is started with args
| arg | value |
| command | ls -1 /usr/lib/jvm |
Then available container log should not contain java-1.8.0
Then available container log should not contain java-11
Then available container log should not contain java-21

@ubi9/openjdk-21
@ubi9/openjdk-21-runtime
Scenario: Check that directories from other JDKs are not present (JDK21)
When container is started with args
| arg | value |
| command | ls -1 /usr/lib/jvm |
Then available container log should not contain java-1.8.0
Then available container log should not contain java-11
Then available container log should not contain java-17

@ubi9
Scenario: Ensure LANG is defined and contains UTF-8
When container is started with args
| arg | value |
| command | bash -c "$JAVA_HOME/bin/java -XshowSettings:properties -version" |
Then available container log should contain file.encoding = UTF-8

@ubi9
Scenario: Ensure tar is installed (OPENJDK-1165)
When container is started with args
| arg | value |
| command | tar |
Then available container log should not contain command not found

@ubi9
Scenario: Ensure tzdata RPM is properly installed (OPENJDK-2519)
When container is started with args
| arg | value |
| command | rpm -V tzdata |
Then available container log should not contain missing
1 change: 1 addition & 0 deletions modules/jre/11/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
1 change: 1 addition & 0 deletions modules/jre/17/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
1 change: 1 addition & 0 deletions modules/jre/21/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
1 change: 1 addition & 0 deletions modules/jre/8/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ packages:
modules:
install:
- name: jboss.container.user
- name: jboss.container.openjdk

execute:
- script: configure.sh
61 changes: 61 additions & 0 deletions modules/jvm/tests/features/gc.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@ubi9
Feature: Openshift OpenJDK GC tests

Scenario: Check default GC configuration
Given container is started as uid 1000
Then container log should contain -XX:+UseParallelGC
And container log should contain -XX:MinHeapFreeRatio=10
And container log should contain -XX:MaxHeapFreeRatio=20
And container log should contain -XX:GCTimeRatio=4

Scenario: Check GC_MIN_HEAP_FREE_RATIO GC configuration
Given container is started with env
| variable | value |
| GC_MIN_HEAP_FREE_RATIO | 5 |
Then container log should contain -XX:MinHeapFreeRatio=5

Scenario: Check GC_MAX_HEAP_FREE_RATIO GC configuration
Given container is started with env
| variable | value |
| GC_MAX_HEAP_FREE_RATIO | 50 |
Then container log should contain -XX:MaxHeapFreeRatio=50

Scenario: Check GC_TIME_RATIO GC configuration
Given container is started with env
| variable | value |
| GC_TIME_RATIO | 5 |
Then container log should contain -XX:GCTimeRatio=5

Scenario: Check GC_ADAPTIVE_SIZE_POLICY_WEIGHT GC configuration
Given container is started with env
| variable | value |
| GC_ADAPTIVE_SIZE_POLICY_WEIGHT | 80 |
Then container log should contain -XX:AdaptiveSizePolicyWeight=80

Scenario: Check GC_MAX_METASPACE_SIZE GC configuration
Given container is started with env
| variable | value |
| GC_MAX_METASPACE_SIZE | 120 |
Then container log should contain -XX:MaxMetaspaceSize=120m

Scenario: Check GC_CONTAINER_OPTIONS configuration
Given container is started with env
| variable | value |
| GC_CONTAINER_OPTIONS | -XX:+UseG1GC |
Then container log should contain -XX:+UseG1GC
And container log should not contain -XX:+UseParallelGC

Scenario: Check GC_METASPACE_SIZE GC configuration
Given container is started with env
| variable | value |
| GC_METASPACE_SIZE | 120 |
Then container log should contain -XX:MetaspaceSize=120m
And container log should not contain integer expression expected

Scenario: Check GC_METASPACE_SIZE constrained by GC_MAX_METASPACE_SIZE GC configuration
Given container is started with env
| variable | value |
| GC_METASPACE_SIZE | 120 |
| GC_MAX_METASPACE_SIZE | 90 |
Then container log should contain -XX:MaxMetaspaceSize=90m
And container log should contain -XX:MetaspaceSize=90m
41 changes: 41 additions & 0 deletions modules/jvm/tests/features/memory.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Feature: OPENJDK-559 JVM Memory tests

@ubi9
Scenario: Check default JVM max heap configuration
Given container is started as uid 1000
Then container log should contain -XX:MaxRAMPercentage=80.0

@ubi9
Scenario: Check configured JVM max heap configuration and ensure JAVA_MAX_MEM_RATIO accepts floats but only takes whole number part
Given container is started with env
| variable | value |
| JAVA_MAX_MEM_RATIO | 90.4 |
Then container log should contain -XX:MaxRAMPercentage=90.0

@ubi9
Scenario: Ensure JAVA_MAX_MEM_RATIO accepts Integers
Given container is started with env
| variable | value |
| JAVA_MAX_MEM_RATIO | 90 |
Then container log should contain -XX:MaxRAMPercentage=90.0

@ubi9
Scenario: Ensure JAVA_MAX_MEM_RATIO=0 disables parameter
Given container is started with env
| variable | value |
| JAVA_MAX_MEM_RATIO | 0 |
Then container log should not contain -XX:MaxRAMPercentage

@ubi9
Scenario: Check default JVM initial heap configuration is unspecified
Given container is started as uid 1000
Then container log should not contain -XX:InitialRAMPercentage
And container log should not contain -Xms

# Not the runtime images
@ubi9/openjdk-11
@ubi9/openjdk-17
@ubi9/openjdk-21
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$
Loading
Loading