Skip to content

Commit 9d1a83c

Browse files
authored
CORS-3462: extract static openshift-installer from 4.16 (#1653)
* Refactor calculation of default installer cmd for extraction Dynamically determine the installer command to extract from the payload. After extraction, rename it to "openshift-install" so that we always have a consistent command name, regardless of what was extracted or if we built it locally. * Switch from openshift-baremetal-install to openshift-install from 4.16 This allows us to continue to run on RHEL/CentOS 8. openshift-baremetal-install will be dynamically linked for RHEL 9 starting with 4.16. * Use FIPS-capable installer when requested Only do this if FIPS_VALIDATE is set to true, otherwise this will break the ability to test FIPS on RHEL/CentOS 8 with OCP 4.16 and later.
1 parent b24c4e6 commit 9d1a83c

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

03_build_installer.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ function build_installer() {
2020
# Build installer
2121
pushd .
2222
cd $OPENSHIFT_INSTALL_PATH
23-
TAGS="${OPENSHIFT_INSTALLER_BUILD_TAGS:-libvirt baremetal}" DEFAULT_ARCH=$(get_arch) hack/build.sh
23+
local default_tags="libvirt baremetal"
24+
if [[ "${FIPS_MODE:-false}" = "true" && "${FIPS_VALIDATE:-false}" = "true" ]]; then
25+
default_tags="${default_tags} fipscapable"
26+
fi
27+
TAGS="${OPENSHIFT_INSTALLER_BUILD_TAGS:-${default_tags}}" DEFAULT_ARCH=$(get_arch) hack/build.sh
2428
popd
2529
# This is only needed in rhcos.sh for old versions which lack the
2630
# openshift-install coreos-print-stream-json option
@@ -33,13 +37,18 @@ function build_installer() {
3337
}
3438

3539
function extract_installer() {
36-
local release_image
37-
local outdir
40+
local release_image="$1"
41+
local outdir="$2"
42+
local cmd
43+
44+
cmd="${OPENSHIFT_INSTALLER_CMD:-$(default_installer_cmd)}"
3845

39-
release_image="$1"
40-
outdir="$2"
46+
extract_command "${cmd}" "${release_image}" "${outdir}"
4147

42-
extract_command "${OPENSHIFT_INSTALLER_CMD:-openshift-baremetal-install}" "$1" "$2"
48+
local target="openshift-install"
49+
if [ "${cmd}" != "${target}" ]; then
50+
mv "${outdir}/${cmd}" "${outdir}/${target}"
51+
fi
4352
}
4453

4554
early_deploy_validation

common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ if [ "${UPSTREAM_IRONIC:-false}" != "false" ] ; then
206206
fi
207207

208208
if [ -z "$KNI_INSTALL_FROM_GIT" ]; then
209-
export OPENSHIFT_INSTALLER=${OPENSHIFT_INSTALLER:-${OCP_DIR}/openshift-baremetal-install}
209+
export OPENSHIFT_INSTALLER=${OPENSHIFT_INSTALLER:-${OCP_DIR}/openshift-install}
210210
else
211211
export OPENSHIFT_INSTALLER=${OPENSHIFT_INSTALLER:-$OPENSHIFT_INSTALL_PATH/bin/openshift-install}
212212

utils.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ set -o pipefail
44

55
source release_info.sh
66

7+
function default_installer_cmd() {
8+
if is_lower_version "$(openshift_version "${OCP_DIR}")" "4.16" || [[ "${FIPS_MODE:-false}" = "true" && "${FIPS_VALIDATE:-false}" = "true" ]]; then
9+
printf "openshift-baremetal-install"
10+
else
11+
printf "openshift-install"
12+
fi
13+
}
14+
715
function retry_with_timeout() {
816
retries=$1
917
timeout_duration=$2
@@ -458,7 +466,7 @@ function setup_legacy_release_mirror {
458466
#To ensure that you use the correct images for the version of OpenShift Container Platform that you selected,
459467
#you must extract the installation program from the mirrored content:
460468
if [ -z "$KNI_INSTALL_FROM_GIT" ]; then
461-
local installer="${OPENSHIFT_INSTALLER_CMD:-openshift-baremetal-install}"
469+
local installer="${OPENSHIFT_INSTALLER_CMD:-$(default_installer_cmd)}"
462470
463471
EXTRACT_DIR=$(mktemp --tmpdir -d "mirror-installer--XXXXXXXXXX")
464472
_tmpfiles="$_tmpfiles $EXTRACT_DIR"

0 commit comments

Comments
 (0)