Skip to content

Commit 4543cd2

Browse files
committed
AGENT-1193: Custom openshift-install can be used by appliance
If the openshift-install binary was built from source, this change creates a symlink to it in the appliance's asset directory. Placing it in the asset directory will signal to the appliance to use it instead of downloading it from the release. This allows us to test changes in the installer repo without having to wait for it to merge and appear in an offcial release image. Hard coding to version 4.19 in the directory structures used by the *agent_iso_no_registry functions has also be removed.
1 parent 437d865 commit 4543cd2

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

agent/03_agent_build_installer.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ source $SCRIPTDIR/logging.sh
88
source $SCRIPTDIR/common.sh
99
source $SCRIPTDIR/agent/common.sh
1010

11-
# Temporarily skip building the agent installer in case of OVE ISO
12-
if [[ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISO_NO_REGISTRY" ]]; then
13-
exit 0
14-
fi
15-
1611
# Override build tags
1712
export OPENSHIFT_INSTALLER_BUILD_TAGS=" "
1813

agent/06_agent_create_cluster.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ function create_agent_iso_no_registry() {
8787
if [[ ! -d $OPENSHIFT_AGENT_INSTALER_UTILS_PATH ]]; then
8888
sync_repo_and_patch go/src/github.com/openshift/agent-installer-utils https://github.com/openshift/agent-installer-utils.git
8989
fi
90+
91+
# If the openshift-install binary was built from source, create a symlink to it
92+
# in the appliance's asset directory. This allows it to be used by the appliance
93+
# to generate the unconfigured-ignition instead of having the appliance downloading
94+
# the binary from the release.
95+
if [ ! -z "$KNI_INSTALL_FROM_GIT" -a -f "${$OCP_DIR}/openshift-install" ]; then
96+
mkdir -p "$OCP_DIR/iso_builder/${full_ocp_version}/appliance/"
97+
ln -s "${$OCP_DIR}/openshift-install" "$OCP_DIR/iso_builder/${full_ocp_version}/appliance/"
98+
fi
99+
90100
# Create agent ISO without registry a.k.a. OVE ISO
91101
local asset_dir=${1}
92102
pushd .
@@ -104,8 +114,8 @@ function create_agent_iso_no_registry() {
104114
function cleanup_diskspace_agent_iso_noregistry() {
105115
local asset_dir=${1%/} # Remove trailing slash if present
106116

107-
# Iterate over all versioned directories matching 4.19.*
108-
for dir in "$asset_dir"/4.19.*; do
117+
# Iterate over all versioned directories matching ${full_ocp_version}*
118+
for dir in "$asset_dir"/${full_ocp_version}*; do
109119
[ -d "$dir" ] || continue
110120

111121
echo "Cleaning up directory: $dir"

agent/common.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,11 @@ export AGENT_ISOLATED_NETWORK=${AGENT_ISOLATED_NETWORK:-"false"}
7979
if [ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISO_NO_REGISTRY" ] ; then
8080
export AGENT_ISOLATED_NETWORK=true
8181
fi
82+
83+
# The OCP version used in agent-installer-utils/tools/iso_builder/hack/helper.sh.
84+
# https://github.com/openshift/agent-installer-utils/blob/6422958144e27dbbe31c7fe98b514d43c988bcfb/tools/iso_builder/hack/helper.sh#L90
85+
# It is slightly different than OPENSHIFT_VERSION.
86+
# dev-scripts may need to create the working directory for the appliance if a custom openshift-install
87+
# binary is built. The same version string is used to be consistent with what is passed to
88+
# build-ove-image.sh in agent-installer-utils.
89+
full_ocp_version=$(skopeo inspect --authfile $PULL_SECRET_FILE docker://$OPENSHIFT_RELEASE_IMAGE | jq -r '.Labels["io.openshift.release"]')

0 commit comments

Comments
 (0)