diff --git a/.pipelines/templates/.builder-release-template.yaml b/.pipelines/templates/.builder-release-template.yaml index 28393f13fc3..9b48d755e5a 100644 --- a/.pipelines/templates/.builder-release-template.yaml +++ b/.pipelines/templates/.builder-release-template.yaml @@ -103,7 +103,7 @@ steps: if [[ "${HYPERV_GENERATION,,}" == "v2" ]]; then SKU_NAME="${SKU_NAME}gen2"; fi && \ if [[ "${ARCHITECTURE,,}" == "arm64" ]]; then SKU_NAME="${SKU_NAME}arm64"; fi && \ if [[ "${ENABLE_FIPS,,}" == "true" ]]; then SKU_NAME="${SKU_NAME}fips"; fi && \ - if [[ "${IMG_SKU}" == "20_04-lts-cvm" ]]; then SKU_NAME="${SKU_NAME}CVM"; fi && \ + if [[ "${IMG_SKU}" == "20_04-lts-cvm" || "${IMG_SKU}" == "cvm" ]]; then SKU_NAME="${SKU_NAME}CVM"; fi && \ if [[ "${IMG_SKU}" == *"minimal"* ]]; then SKU_NAME="${SKU_NAME}minimal"; fi && \ if [[ "${ENABLE_TRUSTED_LAUNCH}" == "True" ]]; then SKU_NAME="${SKU_NAME}TL"; fi && \ if [[ ${OS_SKU} != "CBLMariner" && ${OS_SKU} != "AzureLinux" && "${CONTAINER_RUNTIME}" == "containerd" ]]; then SKU_NAME="${SKU_NAME}containerd"; fi && \ diff --git a/packer.mk b/packer.mk index 39337f3866a..2dc3d988bdf 100755 --- a/packer.mk +++ b/packer.mk @@ -32,6 +32,9 @@ ifeq (${OS_SKU},Ubuntu) ifeq (${IMG_SKU},20_04-lts-cvm) @echo "Using packer template file vhd-image-builder-cvm.json" @packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-cvm.json +else ifeq (${IMG_SKU},cvm) + @echo "Using packer template file vhd-image-builder-cvm.json" + @packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-cvm.json else @echo "Using packer template file vhd-image-builder-base.json" @packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-base.json diff --git a/vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh b/vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh index 7a7f066bb0f..40713465cf1 100755 --- a/vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh +++ b/vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh @@ -67,7 +67,7 @@ if [[ ${OS_TYPE} == "Linux" && ${ENABLE_TRUSTED_LAUNCH} == "True" ]]; then } \ } \ }" -elif [ "${OS_TYPE}" == "Linux" ] && [ "${IMG_SKU,,}" == "20_04-lts-cvm" ]; then +elif [ "${OS_TYPE}" == "Linux" ] && [[ "${IMG_SKU}" == "20_04-lts-cvm" || "${IMG_SKU}" == "cvm" ]]; then az resource create --id $disk_resource_id --is-full-object --location $LOCATION --properties "{\"location\": \"$LOCATION\", \ \"properties\": { \ \"osType\": \"$OS_TYPE\", \ diff --git a/vhdbuilder/packer/init-variables.sh b/vhdbuilder/packer/init-variables.sh index e49c85f235f..e9c2d0073df 100755 --- a/vhdbuilder/packer/init-variables.sh +++ b/vhdbuilder/packer/init-variables.sh @@ -71,7 +71,7 @@ if [ "$MODE" == "linuxVhdMode" ] && [ -z "${PACKER_BUILD_LOCATION}" ]; then exit 1 fi -if [ "${IMG_SKU,,}" == "20_04-lts-cvm" ] && [ -n "${CVM_PACKER_BUILD_LOCATION}" ]; then +if [[ "${IMG_SKU,,}" == "20_04-lts-cvm" || "${IMG_SKU,,}" == "cvm" ]] && [ -n "${CVM_PACKER_BUILD_LOCATION}" ]; then PACKER_BUILD_LOCATION="${CVM_PACKER_BUILD_LOCATION}" echo "CVM: PACKER_BUILD_LOCATION is set to ${PACKER_BUILD_LOCATION}" fi @@ -172,8 +172,8 @@ if [[ "${MODE}" == "linuxVhdMode" ]]; then elif [[ "${IMG_OFFER,,}" == "azure-linux-3" ]]; then # for Azure Linux 3.0, only use AzureLinux prefix SIG_IMAGE_NAME="AzureLinux${SIG_IMAGE_NAME}" - elif [[ "${IMG_SKU,,}" == "20_04-lts-cvm" ]]; then - SIG_IMAGE_NAME+="Specialized" + elif [[ "${IMG_SKU,,}" == "20_04-lts-cvm" || "${IMG_SKU,,}" == "cvm" ]]; then + SIG_IMAGE_NAME+="Specialized" fi echo "No input for SIG_IMAGE_NAME was provided, defaulting to: ${SIG_IMAGE_NAME}" else @@ -261,13 +261,13 @@ if [[ "$MODE" == "linuxVhdMode" || "$MODE" == "windowsVhdMode" ]]; then if [ -z "$id" ]; then echo "Creating image definition ${SIG_IMAGE_NAME} in gallery ${SIG_GALLERY_NAME} resource group ${AZURE_RESOURCE_GROUP_NAME}" # The following conditionals do not require NVMe tagging on disk controller type - if [[ ${ARCHITECTURE,,} == "arm64" ]] || [[ ${IMG_SKU} == "20_04-lts-cvm" ]] || [[ ${HYPERV_GENERATION} == "V1" ]]; then + if [[ ${ARCHITECTURE,,} == "arm64" ]] || [[ ${IMG_SKU} == "20_04-lts-cvm" ]] || [[ ${IMG_SKU} == "cvm" ]] || [[ ${HYPERV_GENERATION} == "V1" ]]; then TARGET_COMMAND_STRING="" if [[ ${ARCHITECTURE,,} == "arm64" ]]; then - TARGET_COMMAND_STRING+="--architecture Arm64" - elif [[ ${IMG_SKU} == "20_04-lts-cvm" ]]; then - TARGET_COMMAND_STRING+="--os-state Specialized --features SecurityType=ConfidentialVM" - fi + TARGET_COMMAND_STRING+="--architecture Arm64" + elif [[ ${IMG_SKU} == "20_04-lts-cvm" ]] || [[ ${IMG_SKU} == "cvm" ]]; then + TARGET_COMMAND_STRING+="--os-state Specialized --features SecurityType=ConfidentialVM" + fi az sig image-definition create \ --resource-group ${AZURE_RESOURCE_GROUP_NAME} \ diff --git a/vhdbuilder/packer/install-dependencies.sh b/vhdbuilder/packer/install-dependencies.sh index 7b8fd39a6d4..87c6c9dcfd6 100644 --- a/vhdbuilder/packer/install-dependencies.sh +++ b/vhdbuilder/packer/install-dependencies.sh @@ -36,7 +36,7 @@ capture_benchmark "${SCRIPT_NAME}_declare_variables_and_source_packer_files" echo "Logging the kernel after purge and reinstall + reboot: $(uname -r)" # fix grub issue with cvm by reinstalling before other deps # other VHDs use grub-pc, not grub-efi -if [[ "${UBUNTU_RELEASE}" == "20.04" ]] && [[ "$IMG_SKU" == "20_04-lts-cvm" ]]; then +if [[ "${UBUNTU_RELEASE}" == "20.04" && "$IMG_SKU" == "20_04-lts-cvm" ]] || [[ "${UBUNTU_RELEASE}" == "24.04" && "$IMG_SKU" == "cvm" ]]; then apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT wait_for_apt_locks apt_get_install 30 1 600 grub-efi || exit 1 diff --git a/vhdbuilder/packer/test/run-test.sh b/vhdbuilder/packer/test/run-test.sh index 31638588868..00aec692fcd 100755 --- a/vhdbuilder/packer/test/run-test.sh +++ b/vhdbuilder/packer/test/run-test.sh @@ -74,7 +74,7 @@ if [ "${OS_TYPE}" == "Linux" ] && [ "${ENABLE_TRUSTED_LAUNCH}" == "True" ]; then TARGET_COMMAND_STRING+="--security-type TrustedLaunch --enable-secure-boot true --enable-vtpm true" fi -if [ "${OS_TYPE}" == "Linux" ] && [ ${IMG_SKU} == "20_04-lts-cvm" ]; then +if [ "${OS_TYPE}" == "Linux" ] && [[ "${IMG_SKU}" == "20_04-lts-cvm" || "${IMG_SKU}" == "cvm" ]]; then # We completely re-assign the TARGET_COMMAND_STRING string here to ensure that no artifacts from earlier conditionals are included TARGET_COMMAND_STRING="--size Standard_DC8ads_v5 --security-type ConfidentialVM --enable-secure-boot true --enable-vtpm true --os-disk-security-encryption-type VMGuestStateOnly --specialized true" fi diff --git a/vhdbuilder/packer/vhd-scanning.sh b/vhdbuilder/packer/vhd-scanning.sh index 9808ef7b48f..c24eba7473e 100755 --- a/vhdbuilder/packer/vhd-scanning.sh +++ b/vhdbuilder/packer/vhd-scanning.sh @@ -63,7 +63,7 @@ if [[ "${OS_TYPE}" == "Linux" && "${ENABLE_TRUSTED_LAUNCH}" == "True" ]]; then VM_OPTIONS+=" --security-type TrustedLaunch --enable-secure-boot true --enable-vtpm true" fi -if [ "${OS_TYPE}" == "Linux" ] && [ ${IMG_SKU} == "20_04-lts-cvm" ]; then +if [ "${OS_TYPE}" == "Linux" ] && [[ "${IMG_SKU}" == "20_04-lts-cvm" || "${IMG_SKU}" == "cvm" ]]; then # We completely re-assign the VM_OPTIONS string here to ensure that no artifacts from earlier conditionals are included VM_OPTIONS="--size Standard_DC8ads_v5 --security-type ConfidentialVM --enable-secure-boot true --enable-vtpm true --os-disk-security-encryption-type VMGuestStateOnly --specialized true" fi