Skip to content

Commit 3bd711b

Browse files
Jan Lieskovskypskopek
authored andcommitted
[CIAM-1757] On each arch remove JDK 1.8 rpms if present (since using JDK 11 already)
Thanks to Alex for suggestions on how to simplify the 'rpm -qa' statements Signed-off-by: Jan Lieskovsky <[email protected]>
1 parent 694e27e commit 3bd711b

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

image.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,17 @@ modules:
124124
- name: openshift-layer
125125
- name: keycloak-layer
126126

127-
# Various SSO image pre-launch checks to prevent regressions
128-
- name: sso-pre-launch-checks
129-
130-
# This needs to be the very last, after all updates to standalone-openshift.xml have been done. See eg. https://access.redhat.com/solutions/3402171 for use
127+
# The extensions module can be called only after all updates to standalone-openshift.xml have been done.
128+
# See eg. https://access.redhat.com/solutions/3402171 for details how to use
131129
- name: sso-cli-extensions
132130

133-
# Actions performed by the 'sso-rm-openjdk' module shouldn't be needed for RHEL-8 UBI Minimal
134-
# derived images already. But it's kept & called here for any case, so RPMs belonging to
135-
# counterpart JVM aren't left in the image by an accident
131+
# Ensure RPMs belonging to counterpart JVM are removed
136132
- name: sso-rm-openjdk
137133
version: *jdk_version
138134

135+
# Various SSO image pre-launch checks to prevent regressions
136+
- name: sso-pre-launch-checks
137+
139138
packages:
140139
manager: microdnf
141140
content_sets_file: content_sets.yaml

modules/sso/sso-pre-launch-checks/added/sso_image_pre_launch_checks.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ source "${JBOSS_HOME}/bin/launch/logging.sh"
99
function postConfigure() {
1010
verify_CVE_2020_10695_fix_present
1111
verify_KEYCLOAK_16736_fix_present
12+
verify_CIAM_1757_fix_present
1213
}
1314

1415
# KEYCLOAK-13585 / RH BZ#1817530 / CVE-2020-10695:
@@ -40,10 +41,10 @@ function verify_KEYCLOAK_16736_fix_present() {
4041
# regardless of the particular image release
4142
# shellcheck disable=SC2061
4243
# shellcheck disable=SC2086
43-
local -r ssoImageDockerfile=$(find /root/buildinfo -maxdepth 1 -type f -name Dockerfile-${JBOSS_IMAGE_NAME/\//-}-${JBOSS_IMAGE_VERSION}-*)
44+
local -r ssoImageDockerfile=$(find /root/buildinfo -maxdepth 1 -type f -name Dockerfile-${JBOSS_IMAGE_NAME/\//-}-${JBOSS_IMAGE_VERSION}-* 2>/dev/null)
4445
local -r errorExitCode="1"
4546
# Throw an error if the image doesn't contain a Dockerfile we could check
46-
if [ "x${ssoImageDockerfile}x" == "xx" ]
47+
if [ -z "${ssoImageDockerfile}" ]
4748
then
4849
log_error "The specified Dockerfile: '${ssoImageDockerfile}' does not exist!"
4950
exit "${errorExitCode}"
@@ -60,3 +61,17 @@ function verify_KEYCLOAK_16736_fix_present() {
6061
exit "${errorExitCode}"
6162
fi
6263
}
64+
65+
# CIAM-1757:
66+
#
67+
# Confirm JDK 1.8 rpms aren't present in the image, since using JDK 11 already
68+
#
69+
function verify_CIAM_1757_fix_present() {
70+
local -r errorExitCode="1"
71+
if [ -n "$(rpm --query --all name=java* version=1.8.0*)" ]
72+
then
73+
log_error "JDK 1.8 rpms detected in the image. It is recommended to uninstall them."
74+
log_error "Cannot start the '${JBOSS_IMAGE_NAME}', version '${JBOSS_IMAGE_VERSION}'!"
75+
exit "${errorExitCode}"
76+
fi
77+
}

modules/sso/sso-rm-openjdk/11/configure.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22
set -eu
33

44
# Import RH-SSO global variables & functions to image build-time
@@ -15,3 +15,6 @@ if rpm -q ibm-semeru-open-11-jdk || rpm -q java-11-openj9-devel; then
1515
fi
1616
done
1717
fi
18+
19+
# CIAM-1757: On each arch remove JDK 1.8 rpms if present (since using JDK 11 already)
20+
rpm --query --all name=java* version=1.8.0* | xargs rpm -e --nodeps

0 commit comments

Comments
 (0)