From 52eb3b23f39298263f0b7888ca59b1eb62ee4e29 Mon Sep 17 00:00:00 2001 From: Sayan Chowdhury Date: Wed, 13 Apr 2022 19:26:44 +0530 Subject: [PATCH 1/6] ci-automation/azure: Add initial container tests infra for Azure Signed-off-by: Sayan Chowdhury --- ci-automation/ci-config.env | 11 ++++ ci-automation/vendor-testing/azure.sh | 83 +++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100755 ci-automation/vendor-testing/azure.sh diff --git a/ci-automation/ci-config.env b/ci-automation/ci-config.env index 2875c8f5b1..0acb065266 100644 --- a/ci-automation/ci-config.env +++ b/ci-automation/ci-config.env @@ -119,3 +119,14 @@ VMWARE_ESX_PARALLEL="${PARALLEL_TESTS:-4}" AWS_PARALLEL="${PARALLEL_TESTS:-8}" # AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY should come from # sdk_container/.env + +# -- Azure -- +: ${AZURE_HYPER_V_GENERATION:="V2"} +: ${AZURE_IMAGE_NAME:="flatcar_production_azure_image.vhd"} +: ${AZURE_MACHINE_SIZE:="Standard_D2s_v4"} +: ${AZURE_MORE_MACHINE_SIZE:="Standard_D2s_v4"} +: ${AZURE_USE_GALLERY:=""} +: ${AZURE_USE_PRIVATE_IPS:=true} +: ${AZURE_VNET_SUBNET_NAME:="jenkins-vnet-westeurope"} +AZURE_PARALLEL="${PARALLEL_TESTS:-20}" +AZURE_LOCATION="${AZURE_LOCATION:-westeurope}" diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh new file mode 100755 index 0000000000..c20376e2c6 --- /dev/null +++ b/ci-automation/vendor-testing/azure.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Copyright (c) 2021 The Flatcar Maintainers. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -euo pipefail + +set -x + +# Test execution script for the qemu vendor image. +# This script is supposed to run in the SDK container. + +# $@ now contains tests / test patterns to run + +source ci-automation/vendor_test.sh + +board="${CIA_ARCH}-usr" +basename="ci-${CIA_VERNUM//+/-}" +azure_instance_type="${AZURE_MACHINE_SIZE}" +azure_vnet_subnet_name="jenkins-vnet-${AZURE_LOCATION}" + +azure_profile_config_file='' +secret_to_file azure_profile_config_file "${AZURE_PROFILE}" +azure_auth_config_file='' +secret_to_file azure_auth_config_file "${AZURE_AUTH_CREDENTIALS}" + +testscript="$(basename "$0")" + +# Fetch the Azure image if not present +if [ -f "${AZURE_IMAGE_NAME}" ] ; then + echo "++++ ${testscript}: Using existing ${work_dir}/${AZURE_IMAGE_NAME} for testing ${CIA_VERNUM} (${CIA_ARCH}) ++++" +else + echo "++++ ${testscript}: downloading ${AZURE_IMAGE_NAME} for ${CIA_VERNUM} (${CIA_ARCH}) ++++" + copy_from_buildcache "images/${CIA_ARCH}/${CIA_VERNUM}/${AZURE_IMAGE_NAME}.bz2" . + cp --sparse=always <(lbzcat "${AZURE_IMAGE_NAME}.bz2") "${AZURE_IMAGE_NAME}" + rm "${AZURE_IMAGE_NAME}.bz2" +fi + +if [[ "${CIA_ARCH}" == "arm64" ]]; then + AZURE_USE_GALLERY="--azure-use-gallery" +fi + +set -o noglob + +run_kola_tests() { + local instance_type="${1}"; shift + local instance_tapfile="${1}"; shift + + timeout --signal=SIGQUIT 20h \ + kola run \ + --board="${board}" \ + --basename="${basename}" \ + --parallel="${AZURE_PARALLEL}" \ + --offering=basic \ + --platform=azure \ + --azure-image-file="${AZURE_IMAGE_NAME}" \ + --azure-location="${AZURE_LOCATION}" \ + --azure-profile="${azure_profile_config_file}" \ + --azure-auth="${azure_auth_config_file}" \ + --torcx-manifest=${CIA_TORCX_MANIFEST} \ + --tapfile="${instance_tapfile}" \ + --azure-size=${instance_type} \ + ${AZURE_USE_GALLERY} \ + ${AZURE_HYPER_V_GENERATION:+--azure-hyper-v-generation=${AZURE_HYPER_V_GENERATION}} \ + ${azure_vnet_subnet_name:+--azure-vnet-subnet-name=${azure_vnet_subnet_name}} \ + ${AZURE_USE_PRIVATE_IPS:+--azure-use-private-ips=${AZURE_USE_PRIVATE_IPS}} \ + "${@}" +} + +query_kola_tests() { + shift; # ignore the instance type + kola list --platform=azure --filter "${@}" +} + +run_kola_tests_on_instances \ + "${azure_instance_type}" \ + "${CIA_TAPFILE}" \ + "${CIA_FIRST_RUN}" \ + "" \ + '--' \ + '' \ + '--' \ + "${@}" From b9cf2739176c7f31cae542883437e6688043060b Mon Sep 17 00:00:00 2001 From: Sayan Chowdhury Date: Wed, 25 May 2022 14:26:27 +0530 Subject: [PATCH 2/6] fixup! ci-automation/azure: Add initial container tests infra for Azure --- ci-automation/ci-config.env | 1 - ci-automation/vendor-testing/azure.sh | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ci-automation/ci-config.env b/ci-automation/ci-config.env index 0acb065266..afd9212c92 100644 --- a/ci-automation/ci-config.env +++ b/ci-automation/ci-config.env @@ -121,7 +121,6 @@ AWS_PARALLEL="${PARALLEL_TESTS:-8}" # sdk_container/.env # -- Azure -- -: ${AZURE_HYPER_V_GENERATION:="V2"} : ${AZURE_IMAGE_NAME:="flatcar_production_azure_image.vhd"} : ${AZURE_MACHINE_SIZE:="Standard_D2s_v4"} : ${AZURE_MORE_MACHINE_SIZE:="Standard_D2s_v4"} diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh index c20376e2c6..ca6fc19ded 100755 --- a/ci-automation/vendor-testing/azure.sh +++ b/ci-automation/vendor-testing/azure.sh @@ -15,9 +15,10 @@ set -x source ci-automation/vendor_test.sh board="${CIA_ARCH}-usr" -basename="ci-${CIA_VERNUM//+/-}" +basename="ci-${CIA_VERNUM//+/-}-${CIA_ARCH}" azure_instance_type="${AZURE_MACHINE_SIZE}" azure_vnet_subnet_name="jenkins-vnet-${AZURE_LOCATION}" +IS_AMD64=${CIA_ARCH//arm64/} azure_profile_config_file='' secret_to_file azure_profile_config_file "${AZURE_PROFILE}" @@ -43,8 +44,12 @@ fi set -o noglob run_kola_tests() { - local instance_type="${1}"; shift local instance_tapfile="${1}"; shift + local hyperv_gen="v2" + if [ "${instance_type}" = "v1" ]; then + hyperv_gen="v1" + instance_type="${azure_instance_type}" + fi timeout --signal=SIGQUIT 20h \ kola run \ @@ -60,8 +65,8 @@ run_kola_tests() { --torcx-manifest=${CIA_TORCX_MANIFEST} \ --tapfile="${instance_tapfile}" \ --azure-size=${instance_type} \ + --azure-hyper-v-generation=${hyperv_gen} \ ${AZURE_USE_GALLERY} \ - ${AZURE_HYPER_V_GENERATION:+--azure-hyper-v-generation=${AZURE_HYPER_V_GENERATION}} \ ${azure_vnet_subnet_name:+--azure-vnet-subnet-name=${azure_vnet_subnet_name}} \ ${AZURE_USE_PRIVATE_IPS:+--azure-use-private-ips=${AZURE_USE_PRIVATE_IPS}} \ "${@}" @@ -76,7 +81,7 @@ run_kola_tests_on_instances \ "${azure_instance_type}" \ "${CIA_TAPFILE}" \ "${CIA_FIRST_RUN}" \ - "" \ + ${IS_AMD64:+v1} \ '--' \ '' \ '--' \ From b5a62a88dd535113a86e0843d9f2504ef0295e37 Mon Sep 17 00:00:00 2001 From: Sayan Chowdhury Date: Wed, 25 May 2022 15:26:58 +0530 Subject: [PATCH 3/6] fixup! ci-automation/azure: Add initial container tests infra for Azure --- ci-automation/vendor-testing/azure.sh | 37 ++++++++++++++------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh index ca6fc19ded..72c2da40fe 100755 --- a/ci-automation/vendor-testing/azure.sh +++ b/ci-automation/vendor-testing/azure.sh @@ -44,6 +44,7 @@ fi set -o noglob run_kola_tests() { + local instance_type="${1}"; shift local instance_tapfile="${1}"; shift local hyperv_gen="v2" if [ "${instance_type}" = "v1" ]; then @@ -52,24 +53,24 @@ run_kola_tests() { fi timeout --signal=SIGQUIT 20h \ - kola run \ - --board="${board}" \ - --basename="${basename}" \ - --parallel="${AZURE_PARALLEL}" \ - --offering=basic \ - --platform=azure \ - --azure-image-file="${AZURE_IMAGE_NAME}" \ - --azure-location="${AZURE_LOCATION}" \ - --azure-profile="${azure_profile_config_file}" \ - --azure-auth="${azure_auth_config_file}" \ - --torcx-manifest=${CIA_TORCX_MANIFEST} \ - --tapfile="${instance_tapfile}" \ - --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}} \ - "${@}" + kola run \ + --board="${board}" \ + --basename="${basename}" \ + --parallel="${AZURE_PARALLEL}" \ + --offering=basic \ + --platform=azure \ + --azure-image-file="${AZURE_IMAGE_NAME}" \ + --azure-location="${AZURE_LOCATION}" \ + --azure-profile="${azure_profile_config_file}" \ + --azure-auth="${azure_auth_config_file}" \ + --torcx-manifest=${CIA_TORCX_MANIFEST} \ + --tapfile="${instance_tapfile}" \ + --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}} \ + "${@}" } query_kola_tests() { From b30b32d065ea670c442762528f444f8d66f2edf1 Mon Sep 17 00:00:00 2001 From: Sayan Chowdhury Date: Wed, 25 May 2022 17:50:56 +0530 Subject: [PATCH 4/6] fixup! ci-automation/azure: Add initial container tests infra for Azure --- ci-automation/vendor-testing/azure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh index 72c2da40fe..44e78db53f 100755 --- a/ci-automation/vendor-testing/azure.sh +++ b/ci-automation/vendor-testing/azure.sh @@ -84,6 +84,6 @@ run_kola_tests_on_instances \ "${CIA_FIRST_RUN}" \ ${IS_AMD64:+v1} \ '--' \ - '' \ + 'cl.internet' \ '--' \ "${@}" From 3a50a6385f149c611d833ce36f71f2eee0dec5bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Fri, 27 May 2022 06:50:55 +0200 Subject: [PATCH 5/6] Update ci-automation/vendor-testing/azure.sh --- ci-automation/vendor-testing/azure.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh index 44e78db53f..53f336d5df 100755 --- a/ci-automation/vendor-testing/azure.sh +++ b/ci-automation/vendor-testing/azure.sh @@ -41,7 +41,6 @@ if [[ "${CIA_ARCH}" == "arm64" ]]; then AZURE_USE_GALLERY="--azure-use-gallery" fi -set -o noglob run_kola_tests() { local instance_type="${1}"; shift From 60c1733dfbaf0a322e3002d6bf217240240997de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Fri, 27 May 2022 07:51:13 +0200 Subject: [PATCH 6/6] Update ci-automation/vendor-testing/azure.sh --- ci-automation/vendor-testing/azure.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh index 53f336d5df..f7d3517769 100755 --- a/ci-automation/vendor-testing/azure.sh +++ b/ci-automation/vendor-testing/azure.sh @@ -5,7 +5,6 @@ set -euo pipefail -set -x # Test execution script for the qemu vendor image. # This script is supposed to run in the SDK container.