1
1
#! /usr/bin/env bash
2
2
set -euxo pipefail
3
+ shopt -s nocasematch
3
4
4
5
SCRIPTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
5
6
@@ -12,6 +13,7 @@ source $SCRIPTDIR/validation.sh
12
13
source $SCRIPTDIR /release_info.sh
13
14
source $SCRIPTDIR /agent/common.sh
14
15
source $SCRIPTDIR /agent/iscsi_utils.sh
16
+ source $SCRIPTDIR /agent/e2e/agent-tui/utils.sh
15
17
16
18
early_deploy_validation
17
19
@@ -80,6 +82,38 @@ function create_config_image() {
80
82
cp -r ${config_image_dir} /auth ${asset_dir}
81
83
}
82
84
85
+ function create_agent_iso_no_registry() {
86
+ # Create agent ISO without registry a.k.a. OVE ISO
87
+ local asset_dir=${1}
88
+ pushd .
89
+ cd $OPENSHIFT_AGENT_INSTALER_UTILS_PATH /tools/iso_builder
90
+ ./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} "
91
+ popd
92
+ }
93
+
94
+ # Deletes all files and directories under asset_dir
95
+ # example, ocp/ostest/iso_builder/4.19.*
96
+ # except the final generated ISO file (agent-ove.x86_64.iso),
97
+ # to free up disk space while preserving the built artifact.
98
+ # Note: This optional cleanup is relevant only when the
99
+ # AGENT_CLEANUP_ISO_BUILDER_CACHE_LOCAL_DEV is set as as true,
100
+ function cleanup_diskspace_agent_iso_noregistry() {
101
+ local asset_dir=${1%/ } # Remove trailing slash if present
102
+
103
+ # Iterate over all versioned directories matching 4.19.*
104
+ for dir in " $asset_dir " /4.19.* ; do
105
+ [ -d " $dir " ] || continue
106
+
107
+ echo " Cleaning up directory: $dir "
108
+
109
+ # Delete all files and symlinks except the agent-ove.x86_64.iso
110
+ sudo find " $dir " \( -type f -o -type l \) ! -name ' agent-ove.x86_64.iso' -print -delete
111
+
112
+ # Remove any empty directories left behind
113
+ sudo find " $dir " -type d -empty -print -delete
114
+ done
115
+ }
116
+
83
117
function set_device_config_image() {
84
118
85
119
for (( n= 0 ; n< ${2} ; n++ ))
@@ -152,6 +186,52 @@ function attach_appliance_diskimage() {
152
186
done
153
187
}
154
188
189
+ function attach_agent_iso_no_registry() {
190
+ set_file_acl
191
+
192
+ local base_dir=$SCRIPTDIR /$OCP_DIR
193
+ local iso_name=" agent-ove.$( uname -p) .iso"
194
+ local agent_iso_no_registry=$( find " $base_dir " -type f -name " $iso_name " 2> /dev/null | head -n 1)
195
+
196
+ for (( n= 0 ; n< ${2} ; n++ ))
197
+ do
198
+ name=${CLUSTER_NAME} _${1} _${n}
199
+ sudo virt-xml ${name} --add-device --disk " ${agent_iso_no_registry} " ,device=cdrom,target.dev=sdc
200
+ sudo virt-xml ${name} --edit target=sda --disk=" boot_order=1"
201
+ sudo virt-xml ${name} --edit target=sdc --disk=" boot_order=2" --start
202
+ done
203
+ }
204
+
205
+ function automate_rendezvousIP_selection(){
206
+ for (( n= 0 ; n< ${2} ; n++ ))
207
+ do
208
+ name=${CLUSTER_NAME} _${1} _${n}
209
+ # Take screenshots of console before running the automation that configures the rendezvousIP.
210
+ # The screenshot may help us see if agent-tui has reached the expected success state.
211
+ sudo virsh screenshot $name " ${OCP_DIR} /${name} _console_screenshot_before_automation_configures_rendezvousIP.ppm"
212
+
213
+ ./agent/e2e/agent-tui/automate-no-registry-agent-tui.sh $name
214
+
215
+ # Take screenshot of the console after running the automation that configures the rendezvousIP.
216
+ sudo virsh screenshot $name " ${OCP_DIR} /${name} _console_screenshot_after_automation_configures_rendezvousIP.ppm"
217
+ echo " Finished configuring the rendezvousIP via agent-tui for $name "
218
+ done
219
+ }
220
+
221
+ function check_assisted_install_UI(){
222
+ local rendezvousIP=$( getRendezvousIP)
223
+ local url=" http://$rendezvousIP :3001"
224
+ while true ; do
225
+ if curl -s -o /dev/null -w " %{http_code}" " $url " | grep -q " ^200$" ; then
226
+ echo " Assisted install UI is up: $url "
227
+ break
228
+ else
229
+ echo " Assisted install UI not ready, retrying in 30 seconds..."
230
+ sleep 30
231
+ fi
232
+ done
233
+ }
234
+
155
235
function get_node0_ip() {
156
236
node0_name=$( printf ${MASTER_HOSTNAME_FORMAT} 0)
157
237
node0_ip=$( sudo virsh net-dumpxml ostestbm | xmllint --xpath " string(//dns[*]/host/hostname[. = '${node0_name} ']/../@ip)" -)
@@ -435,9 +515,11 @@ function put_operator_file() {
435
515
ssh " ${ssh_opts[@]} " " sudo cp /home/core/operators.yaml /etc/assisted/manifests/."
436
516
}
437
517
438
- asset_dir=" ${1:- ${OCP_DIR} } "
439
- config_image_dir=" ${1:- ${OCP_DIR} / configimage} "
440
- openshift_install=" $( realpath " ${OCP_DIR} /openshift-install" ) "
518
+ if [[ " ${AGENT_E2E_TEST_BOOT_MODE} " != " ISO_NO_REGISTRY" ]]; then
519
+ asset_dir=" ${1:- ${OCP_DIR} } "
520
+ config_image_dir=" ${1:- ${OCP_DIR} / configimage} "
521
+ openshift_install=" $( realpath " ${OCP_DIR} /openshift-install" ) "
522
+ fi
441
523
442
524
case " ${AGENT_E2E_TEST_BOOT_MODE} " in
443
525
" ISO" )
@@ -499,8 +581,38 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
499
581
# (to avoid storage overconsumption on the CI machine)
500
582
sudo rm -f " ${OCP_DIR} /appliance.raw"
501
583
;;
584
+ " ISO_NO_REGISTRY" )
585
+ # Build an (OVE) image which does not need registry setup
586
+ # Run a script from agent-installer-utils which internally uses openshift-appliance
587
+ asset_dir=$SCRIPTDIR /$OCP_DIR /iso_builder
588
+ mkdir -p ${asset_dir}
589
+ create_agent_iso_no_registry ${asset_dir}
590
+
591
+ if [[ " $AGENT_CLEANUP_ISO_BUILDER_CACHE_LOCAL_DEV " == " true" ]]; then
592
+ # reclaim disk space by deleting unwanted cache, other files
593
+ cleanup_diskspace_agent_iso_noregistry ${asset_dir}
594
+ fi
595
+
596
+ attach_agent_iso_no_registry master $NUM_MASTERS
597
+ attach_agent_iso_no_registry worker $NUM_WORKERS
598
+
599
+ echo " Waiting for 2 mins to arrive at agent-tui screen"
600
+ sleep 120
601
+ automate_rendezvousIP_selection master $NUM_MASTERS
602
+ automate_rendezvousIP_selection worker $NUM_WORKERS
603
+
604
+ check_assisted_install_UI
605
+ ;;
502
606
esac
503
607
608
+ if [[ " ${AGENT_E2E_TEST_BOOT_MODE} " == " ISO_NO_REGISTRY" ]]; then
609
+ # Current goal is to only verify if the nodes are booted fine,
610
+ # TUI sets the rendezvous IP correctly and UI is accessible.
611
+ # The next goal is to simulate adding the cluster details via UI
612
+ # and complete the cluster installation.
613
+ exit 0
614
+ fi
615
+
504
616
if [ ! -z " ${AGENT_TEST_CASES:- } " ]; then
505
617
run_agent_test_cases
506
618
fi
@@ -528,6 +640,7 @@ if [[ ! -z $AGENT_OPERATORS ]]; then
528
640
put_operator_file
529
641
fi
530
642
643
+
531
644
wait_for_cluster_ready
532
645
533
646
if [ ! -z " ${AGENT_DEPLOY_MCE} " ]; then
0 commit comments