From 6fe504b796f13198394e4261621cd4eccb8a47fc Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Wed, 17 Apr 2024 15:54:25 +0200 Subject: [PATCH] azure: update logic to reuse image on retries Signed-off-by: Jeremi Piotrowski --- ci-automation/vendor-testing/azure.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/ci-automation/vendor-testing/azure.sh b/ci-automation/vendor-testing/azure.sh index 1aebd65539..64a21f6c97 100755 --- a/ci-automation/vendor-testing/azure.sh +++ b/ci-automation/vendor-testing/azure.sh @@ -19,24 +19,26 @@ azure_instance_type="${!azure_instance_type_var}" azure_vnet_subnet_name="jenkins-vnet-${AZURE_LOCATION}" # Fetch the Azure image if not present -if [ -f "${AZURE_IMAGE_NAME}" ] ; then - echo "++++ ${CIA_TESTSCRIPT}: Using existing ${AZURE_IMAGE_NAME} for testing ${CIA_VERNUM} (${CIA_ARCH}) ++++" -else +if [ ! -f "${AZURE_IMAGE_NAME}" ] ; then echo "++++ ${CIA_TESTSCRIPT}: downloading ${AZURE_IMAGE_NAME} for ${CIA_VERNUM} (${CIA_ARCH}) ++++" copy_from_buildcache "images/${CIA_ARCH}/${CIA_VERNUM}/${AZURE_IMAGE_NAME}.bz2" . copy_from_buildcache "images/${CIA_ARCH}/${CIA_VERNUM}/version.txt" . cp --sparse=always <(lbzcat "${AZURE_IMAGE_NAME}.bz2") "${AZURE_IMAGE_NAME}" rm "${AZURE_IMAGE_NAME}.bz2" + # ore gc will clean this up within 5h + imgid=$(ore azure create-gallery-image --azure-identity \ + --azure-location "${AZURE_LOCATION}" \ + --file "${AZURE_IMAGE_NAME}" \ + --hyper-v-generation V2 \ + --board="${board}" | sed 's/{/\n{/' | tail -n1 | jq -r .ID) + rm -f "${AZURE_IMAGE_NAME}" + touch "${AZURE_IMAGE_NAME}" + echo "Using gallery image: $imgid" + echo "$imgid" >"azure.img" fi -# ore gc will clean this up within 5h -imgid=$(ore azure create-gallery-image --azure-identity \ - --azure-location "${AZURE_LOCATION}" \ - --file "${AZURE_IMAGE_NAME}" \ - --hyper-v-generation V2 \ - --board="${board}" | sed 's/{/\n{/' | tail -n1 | jq -r .ID) -rm -f "${AZURE_IMAGE_NAME}" -echo "Using gallery image: $imgid" +read -r imgid <"azure.img" +echo "++++ ${CIA_TESTSCRIPT}: Using existing $imgid for testing ${CIA_VERNUM} (${CIA_ARCH}) ++++" run_kola_tests() { local instance_type="${1}"; shift