-
Notifications
You must be signed in to change notification settings - Fork 188
/
03_build_installer.sh
executable file
·74 lines (60 loc) · 2.08 KB
/
03_build_installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
set -x
set -e
source logging.sh
source common.sh
source network.sh
source utils.sh
source ocp_install_env.sh
source validation.sh
function clone_installer() {
# Clone repo, if not already present
if [[ ! -d $OPENSHIFT_INSTALL_PATH ]]; then
sync_repo_and_patch go/src/github.com/openshift/installer https://github.com/openshift/installer.git
fi
}
function build_installer() {
# Build installer
pushd .
cd $OPENSHIFT_INSTALL_PATH
local default_tags="libvirt baremetal"
if [[ "${FIPS_MODE:-false}" = "true" && "${FIPS_VALIDATE:-false}" = "true" ]]; then
default_tags="${default_tags} fipscapable"
fi
TAGS="${OPENSHIFT_INSTALLER_BUILD_TAGS:-${default_tags}}" DEFAULT_ARCH=$(get_arch) hack/build.sh
popd
# This is only needed in rhcos.sh for old versions which lack the
# openshift-install coreos-print-stream-json option
# That landed in 4.8, and in 4.10 this file moved, so just
# skip copying it if it's not in the "old" location ref
# https://github.com/openshift/installer/pull/5252
if [ -f "$OPENSHIFT_INSTALL_PATH/data/data/rhcos.json" ]; then
cp "$OPENSHIFT_INSTALL_PATH/data/data/rhcos.json" "$OCP_DIR"
fi
}
function extract_installer() {
local release_image="$1"
local outdir="$2"
local cmd
cmd="${OPENSHIFT_INSTALLER_CMD:-$(default_installer_cmd)}"
extract_command "${cmd}" "${release_image}" "${outdir}"
local target="openshift-install"
if [ "${cmd}" != "${target}" ]; then
mv "${outdir}/${cmd}" "${outdir}/${target}"
fi
}
early_deploy_validation
write_pull_secret
# Extract an updated client tools from the release image
extract_oc "${OPENSHIFT_RELEASE_IMAGE}"
mkdir -p $OCP_DIR
save_release_info ${OPENSHIFT_RELEASE_IMAGE} ${OCP_DIR}
if [ -z "$KNI_INSTALL_FROM_GIT" ]; then
# Extract openshift-install from the release image
extract_installer "${OPENSHIFT_RELEASE_IMAGE}" $OCP_DIR
${OPENSHIFT_INSTALLER} coreos print-stream-json 1>/dev/null 2>&1 || extract_rhcos_json "${OPENSHIFT_RELEASE_IMAGE}" $OCP_DIR
else
# Clone and build the installer from source
clone_installer
build_installer
fi