From cf19a18d14bcf0a96dfc217514cb79d25fd72ea9 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 8 Nov 2022 16:09:23 +0100 Subject: [PATCH] ci-automation: Refactor azure test --- ci-automation/ci-config.env | 13 +++++++++---- ci-automation/vendor-testing/azure.sh | 22 ++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ci-automation/ci-config.env b/ci-automation/ci-config.env index 5c5eaf188b..b72f8988b0 100644 --- a/ci-automation/ci-config.env +++ b/ci-automation/ci-config.env @@ -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'} diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh index 8411680293..57aaf6ce15 100755 --- a/ci-automation/vendor-testing/azure.sh +++ b/ci-automation/vendor-testing/azure.sh @@ -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[@]}" \ "${@}" }