Test Azure images on HyperV Gen1 and Gen2

Related: rhbz#1896264
This commit is contained in:
Alexander Todorov 2021-06-11 15:15:13 +03:00 committed by Alexander Todorov
parent 24f297859c
commit 1eb51b7bab
4 changed files with 22 additions and 2 deletions

View file

@ -152,6 +152,11 @@ Integration:
- aws/rhel-8-x86_64
- aws/rhel-8.4-x86_64
INTERNAL_NETWORK: ["true"]
- SCRIPT:
- azure_hyperv_gen2.sh
RUNNER:
- aws/rhel-8.4-x86_64
INTERNAL_NETWORK: ["true"]
- <<: *INTEGRATION_TESTS
RUNNER:
- aws/rhel-8-x86_64

View file

@ -5,6 +5,7 @@ source /etc/os-release
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
BRANCH_NAME="${BRANCH_NAME:-${CI_COMMIT_BRANCH}}"
BUILD_ID="${BUILD_ID:-${CI_BUILD_ID}}"
HYPER_V_GEN="${HYPER_V_GEN:-V1}"
# Colorful output.
function greenprint {
@ -194,6 +195,8 @@ export TF_VAR_STORAGE_ACCOUNT="$AZURE_STORAGE_ACCOUNT"
export TF_VAR_CONTAINER_NAME="$AZURE_CONTAINER_NAME"
export TF_VAR_BLOB_NAME="$IMAGE_KEY".vhd
export TF_VAR_TEST_ID="$TEST_ID"
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/image#argument-reference
export TF_VAR_HYPER_V_GEN="${HYPER_V_GEN}"
export BLOB_URL="https://$AZURE_STORAGE_ACCOUNT.blob.core.windows.net/$AZURE_CONTAINER_NAME/$IMAGE_KEY.vhd"
export ARM_CLIENT_ID="$AZURE_CLIENT_ID" > /dev/null
export ARM_CLIENT_SECRET="$AZURE_CLIENT_SECRET" > /dev/null
@ -237,10 +240,10 @@ sudo composer-cli compose delete "${COMPOSE_ID}" > /dev/null
# Use the return code of the smoke test to determine if we passed or failed.
if [[ $RESULTS == 1 ]]; then
greenprint "💚 Success"
greenprint "💚 Success with HyperV ${HYPER_V_GEN}"
exit 0
elif [[ $RESULTS != 1 ]]; then
greenprint "❌ Failed"
greenprint "❌ Failed ${HYPER_V_GEN}"
exit 1
fi

View file

@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/image#argument-reference
export HYPER_V_GEN="V2"
/usr/libexec/tests/osbuild-composer/azure.sh

View file

@ -34,6 +34,10 @@ variable "TEST_ID" {
type = string
}
variable "HYPER_V_GEN" {
type = string
}
# Use existing resource group
data "azurerm_resource_group" "testResourceGroup" {
name = var.RESOURCE_GROUP
@ -56,6 +60,7 @@ resource "azurerm_image" "testimage" {
name = join("-", ["image", var.TEST_ID])
location = data.azurerm_resource_group.testResourceGroup.location
resource_group_name = data.azurerm_resource_group.testResourceGroup.name
hyper_v_generation = var.HYPER_V_GEN
os_disk {
os_type = "Linux"