Skip to content

Commit

Permalink
[OPENJDK-2587] Add tzdata module to reinstall tzdata
Browse files Browse the repository at this point in the history
tzdata is deliberately broken in ubi-minimal images (presumably for
disk space reasons). The fix is to reinstall the tzdata package:

    <https://access.redhat.com/solutions/5616681>

This appears to add a neglibible amount to our image sizes (<1%)
but resolves TZ issues for Java applications.

    <https://issues.redhat.com/browse/OPENJDK-2587>

Signed-off-by: Jonathan Dowland <[email protected]>
  • Loading branch information
jmtd committed Dec 18, 2023
1 parent 6934255 commit 78f78b3
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 2 deletions.
14 changes: 14 additions & 0 deletions modules/util/tzdata/execute.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail

for candidate in yum dnf microdnf; do
if command -v "$candidate"; then
mgr="$(command -v "$candidate")"
"$mgr" reinstall tzdata -y && \
"$mgr" -y clean all
exit
fi
done

echo "cannot find a package manager" >&2
exit 1
7 changes: 7 additions & 0 deletions modules/util/tzdata/module.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
schema_version: 1
name: jboss.container.util.tzdata
version: '1.0'
description: Reinstall the tzdata package, to ensure zoneinfo is present

execute:
- script: execute.sh
7 changes: 7 additions & 0 deletions tests/features/java/openjdk.feature
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,10 @@ Feature: Miscellaneous OpenJDK-related unit tests
Then container log should not contain libpwquality
Then container log should not contain libxkbcommon
Then container log should not contain kbd

@ubi8
Scenario: Ensure tzdata RPM is properly installed (OPENJDK-2587)
When container is started with args
| arg | value |
| command | rpm -V tzdata |
Then available container log should not contain missing
3 changes: 2 additions & 1 deletion ubi8-openjdk-11-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ modules:
install:
- name: jboss.container.openjdk.jre
version: "11"
- name: jboss.container.java.jre.run
- name: jboss.container.util.pkg-update
- name: jboss.container.util.tzdata
- name: jboss.container.java.jre.run

help:
add: true
Expand Down
1 change: 1 addition & 0 deletions ubi8-openjdk-11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ modules:
version: "3.8.11"
- name: jboss.container.java.s2i.bash
- name: jboss.container.util.pkg-update
- name: jboss.container.util.tzdata
# required due to jolokia
- name: jboss.container.java.singleton-jdk

Expand Down
3 changes: 2 additions & 1 deletion ubi8-openjdk-17-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ modules:
install:
- name: jboss.container.openjdk.jre
version: "17"
- name: jboss.container.java.jre.run
- name: jboss.container.util.pkg-update
- name: jboss.container.util.tzdata
- name: jboss.container.java.jre.run

help:
add: true
Expand Down
1 change: 1 addition & 0 deletions ubi8-openjdk-17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ modules:
version: "8.6.17"
- name: jboss.container.maven
version: "3.8.17"
- name: jboss.container.util.tzdata
- name: jboss.container.java.s2i.bash
- name: jboss.container.util.pkg-update

Expand Down
1 change: 1 addition & 0 deletions ubi8-openjdk-21-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ modules:
- name: jboss.container.util.pkg-update
- name: jboss.container.openjdk.jre
version: "21"
- name: jboss.container.util.tzdata
- name: jboss.container.java.jre.run

help:
Expand Down
1 change: 1 addition & 0 deletions ubi8-openjdk-21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ modules:
version: "21"
- name: jboss.container.maven
version: "3.8.17"
- name: jboss.container.util.tzdata
- name: jboss.container.java.s2i.bash
- name: jboss.container.java.singleton-jdk

Expand Down

0 comments on commit 78f78b3

Please sign in to comment.