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,39 @@ 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_E2E_TEST_BOOT_MODE is set as as ISO_NO_REGISTRY,
100
+ # which is supported starting from OCP version 4.19+.
101
+ function cleanup_diskspace_agent_iso_noregistry() {
102
+ local asset_dir=${1%/ } # Remove trailing slash if present
103
+
104
+ # Iterate over all versioned directories matching 4.19.*
105
+ for dir in " $asset_dir " /4.19.* ; do
106
+ [ -d " $dir " ] || continue
107
+
108
+ echo " Cleaning up directory: $dir "
109
+
110
+ # Delete all files and symlinks except the agent-ove.x86_64.iso
111
+ sudo find " $dir " \( -type f -o -type l \) ! -name ' agent-ove.x86_64.iso' -print -delete
112
+
113
+ # Remove any empty directories left behind
114
+ sudo find " $dir " -type d -empty -print -delete
115
+ done
116
+ }
117
+
83
118
function set_device_config_image() {
84
119
85
120
for (( n= 0 ; n< ${2} ; n++ ))
@@ -152,6 +187,52 @@ function attach_appliance_diskimage() {
152
187
done
153
188
}
154
189
190
+ function attach_agent_iso_no_registry() {
191
+ set_file_acl
192
+
193
+ local base_dir=$SCRIPTDIR /$OCP_DIR
194
+ local iso_name=" agent-ove.$( uname -p) .iso"
195
+ local agent_iso_no_registry=$( find " $base_dir " -type f -name " $iso_name " 2> /dev/null | head -n 1)
196
+
197
+ for (( n= 0 ; n< ${2} ; n++ ))
198
+ do
199
+ name=${CLUSTER_NAME} _${1} _${n}
200
+ sudo virt-xml ${name} --add-device --disk " ${agent_iso_no_registry} " ,device=cdrom,target.dev=sdc
201
+ sudo virt-xml ${name} --edit target=sda --disk=" boot_order=1"
202
+ sudo virt-xml ${name} --edit target=sdc --disk=" boot_order=2" --start
203
+ done
204
+ }
205
+
206
+ function automate_rendezvousIP_selection(){
207
+ for (( n= 0 ; n< ${2} ; n++ ))
208
+ do
209
+ name=${CLUSTER_NAME} _${1} _${n}
210
+ # Take screenshots of console before running the automation that configures the rendezvousIP.
211
+ # The screenshot may help us see if agent-tui has reached the expected success state.
212
+ sudo virsh screenshot $name " ${OCP_DIR} /${name} _console_screenshot_before_automation_configures_rendezvousIP.ppm"
213
+
214
+ ./agent/e2e/agent-tui/automate-no-registry-agent-tui.sh $name
215
+
216
+ # Take screenshot of the console after running the automation that configures the rendezvousIP.
217
+ sudo virsh screenshot $name " ${OCP_DIR} /${name} _console_screenshot_after_automation_configures_rendezvousIP.ppm"
218
+ echo " Finished configuring the rendezvousIP via agent-tui for $name "
219
+ done
220
+ }
221
+
222
+ function check_assisted_install_UI(){
223
+ local rendezvousIP=$( getRendezvousIP)
224
+ local url=" http://$rendezvousIP :3001"
225
+ while true ; do
226
+ if curl -s -o /dev/null -w " %{http_code}" " $url " | grep -q " ^200$" ; then
227
+ echo " Assisted install UI is up: $url "
228
+ break
229
+ else
230
+ echo " Assisted install UI not ready, retrying in 30 seconds..."
231
+ sleep 30
232
+ fi
233
+ done
234
+ }
235
+
155
236
function get_node0_ip() {
156
237
node0_name=$( printf ${MASTER_HOSTNAME_FORMAT} 0)
157
238
node0_ip=$( sudo virsh net-dumpxml ostestbm | xmllint --xpath " string(//dns[*]/host/hostname[. = '${node0_name} ']/../@ip)" -)
@@ -435,9 +516,11 @@ function put_operator_file() {
435
516
ssh " ${ssh_opts[@]} " " sudo cp /home/core/operators.yaml /etc/assisted/manifests/."
436
517
}
437
518
438
- asset_dir=" ${1:- ${OCP_DIR} } "
439
- config_image_dir=" ${1:- ${OCP_DIR} / configimage} "
440
- openshift_install=" $( realpath " ${OCP_DIR} /openshift-install" ) "
519
+ if [[ " ${AGENT_E2E_TEST_BOOT_MODE} " != " ISO_NO_REGISTRY" ]]; then
520
+ asset_dir=" ${1:- ${OCP_DIR} } "
521
+ config_image_dir=" ${1:- ${OCP_DIR} / configimage} "
522
+ openshift_install=" $( realpath " ${OCP_DIR} /openshift-install" ) "
523
+ fi
441
524
442
525
case " ${AGENT_E2E_TEST_BOOT_MODE} " in
443
526
" ISO" )
@@ -499,8 +582,38 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
499
582
# (to avoid storage overconsumption on the CI machine)
500
583
sudo rm -f " ${OCP_DIR} /appliance.raw"
501
584
;;
585
+ " ISO_NO_REGISTRY" )
586
+ # Build an (OVE) image which does not need registry setup
587
+ # Run a script from agent-installer-utils which internally uses openshift-appliance
588
+ asset_dir=$SCRIPTDIR /$OCP_DIR /iso_builder
589
+ mkdir -p ${asset_dir}
590
+ create_agent_iso_no_registry ${asset_dir}
591
+
592
+ if [[ " $AGENT_CLEANUP_ISO_BUILDER_CACHE_LOCAL_DEV " == " true" ]]; then
593
+ # reclaim disk space by deleting unwanted cache, other files
594
+ cleanup_diskspace_agent_iso_noregistry ${asset_dir}
595
+ fi
596
+
597
+ attach_agent_iso_no_registry master $NUM_MASTERS
598
+ attach_agent_iso_no_registry worker $NUM_WORKERS
599
+
600
+ echo " Waiting for 2 mins to arrive at agent-tui screen"
601
+ sleep 120
602
+ automate_rendezvousIP_selection master $NUM_MASTERS
603
+ automate_rendezvousIP_selection worker $NUM_WORKERS
604
+
605
+ check_assisted_install_UI
606
+ ;;
502
607
esac
503
608
609
+ if [[ " ${AGENT_E2E_TEST_BOOT_MODE} " == " ISO_NO_REGISTRY" ]]; then
610
+ # Current goal is to only verify if the nodes are booted fine,
611
+ # TUI sets the rendezvous IP correctly and UI is accessible.
612
+ # The next goal is to simulate adding the cluster details via UI
613
+ # and complete the cluster installation.
614
+ exit 0
615
+ fi
616
+
504
617
if [ ! -z " ${AGENT_TEST_CASES:- } " ]; then
505
618
run_agent_test_cases
506
619
fi
@@ -528,14 +641,14 @@ if [[ ! -z $AGENT_OPERATORS ]]; then
528
641
put_operator_file
529
642
fi
530
643
644
+
531
645
wait_for_cluster_ready
532
646
533
647
if [ ! -z " ${AGENT_DEPLOY_MCE} " ]; then
534
648
mce_complete_deployment
535
649
fi
536
650
537
651
# e2e test configuration
538
-
539
652
# Configure storage for the image registry
540
653
oc patch configs.imageregistry.operator.openshift.io \
541
654
cluster --type merge --patch ' {"spec":{"storage":{"emptyDir":{}},"managementState":"Managed"}}'
0 commit comments