ci-automation: Refactor azure test

This commit is contained in:
Krzesimir Nowak 2022-11-08 16:09:23 +01:00
parent 2da0f83c7d
commit cf19a18d14
2 changed files with 21 additions and 14 deletions

View File

@ -128,11 +128,16 @@ AWS_PARALLEL="${PARALLEL_TESTS:-8}"
: ${AZURE_IMAGE_NAME:="flatcar_production_azure_image.vhd"}
: ${AZURE_amd64_MACHINE_SIZE:="Standard_D2s_v4"}
: ${AZURE_arm64_MACHINE_SIZE:="Standard_D2pls_v5"}
: ${AZURE_USE_GALLERY:=""}
: ${AZURE_USE_PRIVATE_IPS:=true}
: ${AZURE_VNET_SUBNET_NAME:="jenkins-vnet-westeurope"}
# If not empty, --azure-use-private-ips will be passed to kola
# run. This makes kola to assume that nodes are reachable using
# private IP addresses.
: ${AZURE_USE_PRIVATE_IPS:='true'}
# If not empty, --azure-use-gallery will be passed to kola run. This
# makes kola to use gallery images instead of managed images.
: ${AZURE_USE_GALLERY:=''}
: ${AZURE_LOCATION:='westeurope'}
: ${AZURE_VNET_SUBNET_NAME:="jenkins-vnet-${AZURE_LOCATION}"}
AZURE_PARALLEL="${PARALLEL_TESTS:-20}"
AZURE_LOCATION="${AZURE_LOCATION:-westeurope}"
# -- Openstack --
: ${OPENSTACK_IMAGE_NAME:='flatcar_production_openstack_image.img.gz'}

View File

@ -12,13 +12,21 @@ source ci-automation/vendor_test.sh
# $@ now contains tests / test patterns to run
board="${CIA_ARCH}-usr"
basename="ci-${CIA_VERNUM//+/-}-${CIA_ARCH}"
azure_instance_type_var="AZURE_${CIA_ARCH}_MACHINE_SIZE"
azure_instance_type="${!azure_instance_type_var}"
azure_vnet_subnet_name="jenkins-vnet-${AZURE_LOCATION}"
azure_extra_options=()
other_instance_types=()
if [[ -n "${AZURE_USE_PRIVATE_IPS:-}" ]]; then
azure_extra_options+=( --azure-use-private-ips )
fi
if [[ "${CIA_ARCH}" == "arm64" ]] || [[ -n "${AZURE_USE_GALLERY:-}" ]]; then
azure_extra_options+=( '--azure-use-gallery' )
fi
if [[ -n "${AZURE_VNET_SUBNET_NAME:-}" ]]; then
azure_extra_options+=( --azure-vnet-subnet-name="${AZURE_VNET_SUBNET_NAME}" )
fi
if [[ "${CIA_ARCH}" = 'amd64' ]]; then
other_instance_types+=('V1')
fi
@ -50,10 +58,6 @@ else
rm "${AZURE_IMAGE_NAME}.bz2"
fi
if [[ "${CIA_ARCH}" == "arm64" ]]; then
AZURE_USE_GALLERY="--azure-use-gallery"
fi
run_kola_tests() {
local instance_type="${1}"; shift
@ -74,9 +78,7 @@ run_kola_tests() {
--azure-auth="${azure_auth_config_file}" \
--azure-size="${instance_type}" \
--azure-hyper-v-generation="${hyperv_gen}" \
${AZURE_USE_GALLERY} \
${azure_vnet_subnet_name:+--azure-vnet-subnet-name=${azure_vnet_subnet_name}} \
${AZURE_USE_PRIVATE_IPS:+--azure-use-private-ips=${AZURE_USE_PRIVATE_IPS}} \
"${azure_extra_options[@]}" \
"${@}"
}