Skip to content

Commit a7ebd85

Browse files
authored
AGENT-1292: Create agent OVE UI ISO using Dockerfile (#1794)
Create the agent OVE UI ISO with the Dockerfile added for Konflux integration in order to exercise this build method. Add a flag to switch between using this Dockerfile and the build-ove-image.sh script.
1 parent e68920e commit a7ebd85

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

agent/06_agent_create_cluster.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -euxo pipefail
33
shopt -s nocasematch
44

55
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
6+
ARCH=$(uname -m)
67

78
LOGDIR=${SCRIPTDIR}/logs
89
source $SCRIPTDIR/logging.sh
@@ -59,9 +60,9 @@ function create_factory_image() {
5960
"${openshift_install}" --dir="${asset_dir}" --log-level=debug agent create unconfigured-ignition
6061
base_iso_url=$(oc adm release info --registry-config "$PULL_SECRET_FILE" --image-for=machine-os-images --insecure=true $OPENSHIFT_RELEASE_IMAGE)
6162
mkdir -p $HOME/.cache/agent/image_cache
62-
oc image extract --path /coreos/coreos-$(uname -m).iso:$HOME/.cache/agent/image_cache --registry-config "$PULL_SECRET_FILE" --confirm $base_iso_url
63+
oc image extract --path /coreos/coreos-${ARCH}.iso:$HOME/.cache/agent/image_cache --registry-config "$PULL_SECRET_FILE" --confirm $base_iso_url
6364
local agent_iso_abs_path="$(realpath "${OCP_DIR}")"
64-
podman run --pull=newer --privileged --rm -v /run/udev:/run/udev -v "${agent_iso_abs_path}:${agent_iso_abs_path}" -v "$HOME/.cache/agent/image_cache/:$HOME/.cache/agent/image_cache/" quay.io/coreos/coreos-installer:release iso ignition embed -f -i "${agent_iso_abs_path}/unconfigured-agent.ign" -o "${agent_iso_abs_path}/agent.iso" $HOME/.cache/agent/image_cache/coreos-$(uname -m).iso
65+
podman run --pull=newer --privileged --rm -v /run/udev:/run/udev -v "${agent_iso_abs_path}:${agent_iso_abs_path}" -v "$HOME/.cache/agent/image_cache/:$HOME/.cache/agent/image_cache/" quay.io/coreos/coreos-installer:release iso ignition embed -f -i "${agent_iso_abs_path}/unconfigured-agent.ign" -o "${agent_iso_abs_path}/agent.iso" $HOME/.cache/agent/image_cache/coreos-${ARCH}.iso
6566

6667
if [ "${AGENT_APPLIANCE_HOTPLUG}" != true ]; then
6768
create_config_image
@@ -90,7 +91,13 @@ function create_agent_iso_no_registry() {
9091
local asset_dir=${1}
9192
pushd .
9293
cd $OPENSHIFT_AGENT_INSTALER_UTILS_PATH/tools/iso_builder
93-
./hack/build-ove-image.sh --pull-secret-file "${PULL_SECRET_FILE}" --release-image-url "${OPENSHIFT_RELEASE_IMAGE}" --ssh-key-file "${SSH_KEY_FILE}" --dir "${asset_dir}"
94+
# Build the ISO in the container image
95+
make build-ove-iso-container PULL_SECRET_FILE="${PULL_SECRET_FILE}" RELEASE_IMAGE_URL="${OPENSHIFT_RELEASE_IMAGE}" ARCH=${ARCH}
96+
# Retrieve ISO from container
97+
./hack/iso-from-container.sh
98+
local iso_name="agent-ove.${ARCH}.iso"
99+
echo "Moving ${iso_name} to ${asset_dir}"
100+
mv ./output-iso/${iso_name} "${asset_dir}"
94101
popd
95102
}
96103

@@ -147,7 +154,7 @@ function set_file_acl() {
147154
}
148155

149156
function get_agent_iso() {
150-
local agent_iso="${OCP_DIR}/agent.$(uname -p).iso"
157+
local agent_iso="${OCP_DIR}/agent.${ARCH}.iso"
151158
if [ ! -f "${agent_iso}" -a -f "${OCP_DIR}/agent.iso" ]; then
152159
agent_iso="${OCP_DIR}/agent.iso"
153160
fi
@@ -156,7 +163,7 @@ function get_agent_iso() {
156163

157164
function get_agent_iso_no_registry() {
158165
local base_dir=$SCRIPTDIR/$OCP_DIR
159-
local iso_name="agent-ove.$(uname -p).iso"
166+
local iso_name="agent-ove.${ARCH}.iso"
160167
local agent_iso_no_registry=$(find "$base_dir" -type f -name "$iso_name" 2>/dev/null | head -n 1)
161168
if [ -z "$agent_iso_no_registry" ]; then
162169
echo "Error: No agent OVE ISO found matching ${iso_name} in ${base_dir}" >&2
@@ -289,7 +296,7 @@ function force_mirror_disconnect() {
289296
}
290297

291298
function disable_automated_installation() {
292-
local agent_iso_abs_path="$(realpath "${OCP_DIR}/agent.$(uname -p).iso")"
299+
local agent_iso_abs_path="$(realpath "${OCP_DIR}/agent.${ARCH}.iso")"
293300
local ign_temp_path="$(mktemp --directory)"
294301
_tmpfiles="$_tmpfiles $ign_temp_path"
295302
echo "Extracting ISO ignition..."

agent/cleanup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ if [[ "${AGENT_E2E_TEST_BOOT_MODE}" == "ISCSI" ]]; then
6666
agent_remove_iscsi_disks master $NUM_MASTERS
6767
agent_remove_iscsi_disks worker $NUM_WORKERS
6868
fi
69+
70+
if sudo buildah images --storage-driver vfs | grep -q "localhost/appliance-test"; then
71+
sudo buildah rmi -f --storage-driver vfs localhost/appliance-test
72+
fi

0 commit comments

Comments
 (0)