test/api.sh/aws: verify AMI boot mode
Extend the Cloud API AWS test case to verify the uploaded AMI boot mode. For informational purposes, also log the boot mode of the instance created using the AMI by the test case. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
1d01833153
commit
4afc5f58d0
1 changed files with 28 additions and 0 deletions
|
|
@ -113,6 +113,28 @@ function verify() {
|
|||
--resources "${AWS_SNAPSHOT_ID}" "${AMI_IMAGE_ID}" \
|
||||
--tags Key=gitlab-ci-test,Value=true
|
||||
|
||||
# Verify that the image has the correct boot mode set
|
||||
AMI_BOOT_MODE=$(jq -r '.Images[].BootMode // empty' "$WORKDIR/ami.json")
|
||||
case "$ARCH" in
|
||||
aarch64)
|
||||
# aarch64 image supports only uefi boot mode
|
||||
if [[ "$AMI_BOOT_MODE" != "uefi" ]]; then
|
||||
echo "AMI boot mode is not \"uefi\", but \"$AMI_BOOT_MODE\""
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
x86_64)
|
||||
# x86_64 image supports hybrid boot mode with preference for uefi
|
||||
if [[ "$AMI_BOOT_MODE" != "uefi-preferred" ]]; then
|
||||
echo "AMI boot mode is not \"uefi-preferred\", but \"$AMI_BOOT_MODE\""
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "❌ Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
SHARE_OK=1
|
||||
|
||||
|
|
@ -202,6 +224,12 @@ function verify() {
|
|||
echo "⏱ Waiting for AWS instance to respond to ssh"
|
||||
_instanceWaitSSH "$HOST"
|
||||
|
||||
# log the boot mode of the instance
|
||||
INSTANCE_AMI_BOOT_MODE=$($AWS_CMD ec2 describe-instances --instance-ids "$AWS_INSTANCE_ID" | jq -r '.Reservations[].Instances[].BootMode // empty')
|
||||
INSTANCE_CURRENT_BOOT_MODE=$($AWS_CMD ec2 describe-instances --instance-ids "$AWS_INSTANCE_ID" | jq -r '.Reservations[].Instances[].CurrentInstanceBootMode')
|
||||
echo "Instance AMI boot mode: $INSTANCE_AMI_BOOT_MODE"
|
||||
echo "Instance actual boot mode: $INSTANCE_CURRENT_BOOT_MODE"
|
||||
|
||||
# Verify image
|
||||
_ssh="ssh -oStrictHostKeyChecking=no -i ./keypair.pem $SSH_USER@$HOST"
|
||||
_instanceCheck "$_ssh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue