Skip to content
Merged
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 01_install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ oc_date=0
if which oc 2>&1 >/dev/null ; then
oc_date=$(date -d $(oc version -o json | jq -r '.clientVersion.buildDate') +%s)
fi
if [ ! -f ${oc_tools_dir}/${oc_tools_local_file} ] || [ $oc_date -lt 1559308936 ]; then
if [ ! -f ${oc_tools_dir}/${oc_tools_local_file} ] || [ $oc_date -lt 1566755586 ]; then
mkdir -p ${oc_tools_dir}
cd ${oc_tools_dir}
wget https://mirror.openshift.com/pub/openshift-v4/clients/oc/${oc_version}/linux/oc.tar.gz -O ${oc_tools_local_file}
Expand Down
7 changes: 5 additions & 2 deletions 06_create_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source common.sh
source ocp_install_env.sh

# Do some PULL_SECRET sanity checking
if [[ "${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE}" == *"registry.svc.ci.openshift.org"* ]]; then
if [[ "${OPENSHIFT_RELEASE_IMAGE}" == *"registry.svc.ci.openshift.org"* ]]; then
if [[ "${PULL_SECRET}" != *"registry.svc.ci.openshift.org"* ]]; then
echo "Please get a valid pull secret for registry.svc.ci.openshift.org."
exit 1
Expand All @@ -35,9 +35,12 @@ fi
if [ ! -d ocp ]; then
mkdir -p ocp

# Extract an updated client tools from the release image
extract_oc ${OPENSHIFT_RELEASE_IMAGE}

if [ -z "$KNI_INSTALL_FROM_GIT" ]; then
# Extract openshift-install from the release image
extract_installer "${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE}" ocp/
extract_installer "${OPENSHIFT_RELEASE_IMAGE}" ocp/
else
# Clone and build the installer from source
clone_installer
Expand Down
40 changes: 28 additions & 12 deletions ocp_install_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,48 @@ export DNS_VIP=${DNS_VIP:-"192.168.111.2"}
#
# See https://origin-release.svc.ci.openshift.org/ for release details
#
export OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE="${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE:-registry.svc.ci.openshift.org/ocp/release:4.2}"
export OPENSHIFT_RELEASE_IMAGE="${OPENSHIFT_RELEASE_IMAGE:-registry.svc.ci.openshift.org/ocp/release:4.2}"

function extract_installer() {
function extract_command() {
local release_image
local cmd
local outdir
local extract_dir

release_image="$1"
outdir="$2"
cmd="$1"
release_image="$2"
outdir="$3"

extract_dir=$(mktemp -d "installer--XXXXXXXXXX")
pullsecret_file=$(mktemp "pullsecret--XXXXXXXXXX")

echo "${PULL_SECRET}" > "${pullsecret_file}"
# FIXME: Find the pullspec for baremetal-installer image and extract the image, until
# https://github.com/openshift/oc/pull/57 is merged
baremetal_image=$(oc adm release info --registry-config "${pullsecret_file}" $OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE -o json | jq -r '.references.spec.tags[] | select(.name == "baremetal-installer") | .from.name')
oc image extract --registry-config "${pullsecret_file}" $baremetal_image --path usr/bin/openshift-install:${extract_dir}

chmod 755 "${extract_dir}/openshift-install"
mv "${extract_dir}/openshift-install" "${outdir}"
export OPENSHIFT_INSTALLER="${outdir}/openshift-install"
oc adm release extract --registry-config "${pullsecret_file}" --command=$cmd --to "${extract_dir}" ${release_image}

mv "${extract_dir}/${cmd}" "${outdir}"
rm -rf "${extract_dir}"
rm -rf "${pullsecret_file}"
}

# Let's always grab the `oc` from the release we're using.
function extract_oc() {
extract_dir=$(mktemp -d "installer--XXXXXXXXXX")
extract_command oc "$1" "${extract_dir}"
sudo mv "${extract_dir}/oc" /usr/local/bin
rm -rf "${extract_dir}"
}

function extract_installer() {
local release_image
local outdir

release_image="$1"
outdir="$2"

extract_command openshift-baremetal-install "$1" "$2"
export OPENSHIFT_INSTALLER="${outdir}/openshift-baremetal-install"
}

function clone_installer() {
# Clone repo, if not already present
if [[ ! -d $OPENSHIFT_INSTALL_PATH ]]; then
Expand Down