Skip to content

Commit

Permalink
Merge branch 'master' into andyzhangx/upgrade-file-driver-v1.31.3
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx authored Jan 28, 2025
2 parents 3b30e48 + a6e4f9a commit d99dec0
Show file tree
Hide file tree
Showing 14 changed files with 775 additions and 31 deletions.
5 changes: 4 additions & 1 deletion .pipelines/.vsts-vhd-builder-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ stages:
echo '##vso[task.setvariable variable=IMG_SKU]20_04-lts-cvm'
echo '##vso[task.setvariable variable=IMG_VERSION]latest'
echo '##vso[task.setvariable variable=HYPERV_GENERATION]V2'
echo '##vso[task.setvariable variable=AZURE_VM_SIZE]Standard_D16ds_v5'
echo '##vso[task.setvariable variable=AZURE_VM_SIZE]Standard_DC16ads_v5'
echo '##vso[task.setvariable variable=FEATURE_FLAGS]None'
echo '##vso[task.setvariable variable=CONTAINER_RUNTIME]containerd'
echo '##vso[task.setvariable variable=ARCHITECTURE]X86_64'
Expand Down Expand Up @@ -1272,3 +1272,6 @@ stages:
TAGS_TO_SKIP: "os=windows"
jobs:
- template: ./templates/e2e-template.yaml
parameters:
name: All Linux

2 changes: 2 additions & 0 deletions .pipelines/e2e-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ pr:
- /**/*.md
jobs:
- template: ./templates/e2e-template.yaml
parameters:
name: Windows Tests
2 changes: 2 additions & 0 deletions .pipelines/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ pr:
- /**/*.md
jobs:
- template: ./templates/e2e-template.yaml
parameters:
name: Linux Tests
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ parameters:

stages:
- stage: build_${{ parameters.stageName }}
# Put the artifact name first so it doesn't get truncated as much in ADO
displayName: Build (${{ parameters.artifactName }})
condition: and(succeeded(), eq('${{ parameters.build }}', True))
dependsOn: [ ]
jobs:
Expand All @@ -56,9 +58,13 @@ stages:
artifactName: ${{ parameters.artifactName }}

- stage: e2e_${{ parameters.stageName }}
displayName: E2E (${{ parameters.artifactName }})
dependsOn: build_${{ parameters.stageName }}
condition: and(succeeded(), eq('${{ parameters.build }}', True))
variables:
TAGS_TO_RUN: imageName=${{ parameters.imageName }}
jobs:
- template: ./e2e-template.yaml
parameters:
name: For image ${{ parameters.imageName }}

3 changes: 3 additions & 0 deletions .pipelines/templates/.builder-release-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ steps:
echo "##vso[task.setvariable variable=SKU_NAME]$SKU_NAME"
echo "Set SKU_NAME to $SKU_NAME"
displayName: Set SKU Name
- bash: make -f packer.mk run-packer
displayName: Build VHD
retryCountOnTaskFailure: 3
Expand All @@ -128,6 +129,8 @@ steps:
PACKER_VNET_NAME="$(cat vhdbuilder/packer/settings.json | grep "vnet_name" | awk -F':' '{print $2}' | awk -F'"' '{print $2}')" && \
CAPTURED_SIG_VERSION="$(cat vhdbuilder/packer/settings.json | grep "captured_sig_version" | awk -F':' '{print $2}' | awk -F'"' '{print $2}')" && \
SIG_IMAGE_NAME="$(cat vhdbuilder/packer/settings.json | grep "sig_image_name" | awk -F':' '{print $2}' | awk -F'"' '{print $2}')" && \
BUILD_LOCATION="$(cat vhdbuilder/packer/settings.json | grep "location" | awk -F':' '{print $2}' | awk -F'"' '{print $2}')" && \
echo "##vso[task.setvariable variable=PACKER_BUILD_LOCATION]${BUILD_LOCATION}" && \
echo "##vso[task.setvariable variable=PACKER_VNET_RESOURCE_GROUP_NAME]${PACKER_VNET_RESOURCE_GROUP_NAME}" && \
echo "##vso[task.setvariable variable=PACKER_VNET_NAME]${PACKER_VNET_NAME}" && \
echo "##vso[task.setvariable variable=VHD_NAME]${CAPTURED_SIG_VERSION}.vhd" && \
Expand Down
8 changes: 7 additions & 1 deletion .pipelines/templates/e2e-template.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
parameters:
- name: name
type: string
displayName: Additional name for the pipeline step
default: ""

jobs:
- job: e2e
condition: and(succeeded(), ne(variables.SKIP_E2E_TESTS, 'true'))
Expand All @@ -6,7 +12,7 @@ jobs:
pool:
name: $(E2E_POOL_NAME)
timeoutInMinutes: 90
displayName: Run AgentBaker E2E
displayName: Run AgentBaker E2E ${{parameters.name}}
steps:
- bash: |
set -ex
Expand Down
7 changes: 6 additions & 1 deletion packer.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ else
$(error HYPERV_GENERATION was invalid ${HYPERV_GENERATION})
endif
ifeq (${OS_SKU},Ubuntu)
@echo "Using packer template file: vhd-image-builder-base.json"
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
@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
endif
else ifeq (${OS_SKU},CBLMariner)
@echo "Using packer template file vhd-image-builder-mariner.json"
@packer build -var-file=vhdbuilder/packer/settings.json vhdbuilder/packer/vhd-image-builder-mariner.json
Expand Down
16 changes: 14 additions & 2 deletions parts/linux/cloud-init/artifacts/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@
},
{
"renovateTag": "registry=https://mcr.microsoft.com, name=containernetworking/azure-cni",
"latestVersion": "v1.5.38",
"latestVersion": "v1.5.41",
"previousLatestVersion": "v1.5.38",
"containerImagePrefetch": {
"latestVersion": {
"binaries": [
"/dropgz"
]
},
"previousLatestVersion": {
"binaries": [
"/dropgz"
]
}
}
},
Expand Down Expand Up @@ -107,12 +113,18 @@
},
{
"renovateTag": "registry=https://mcr.microsoft.com, name=containernetworking/azure-cns",
"latestVersion": "v1.5.38",
"latestVersion": "v1.5.41",
"previousLatestVersion": "v1.5.38",
"containerImagePrefetch": {
"latestVersion": {
"binaries": [
"/usr/local/bin/azure-cns"
]
},
"previousLatestVersion": {
"binaries": [
"/usr/local/bin/azure-cns"
]
}
}
},
Expand Down
17 changes: 16 additions & 1 deletion vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ if [[ ${OS_TYPE} == "Linux" && ${ENABLE_TRUSTED_LAUNCH} == "True" ]]; then
} \
} \
}"
elif [ "${OS_TYPE}" == "Linux" ] && [ "${IMG_SKU,,}" == "20_04-lts-cvm" ]; then
az resource create --id $disk_resource_id --is-full-object --location $LOCATION --properties "{\"location\": \"$LOCATION\", \
\"properties\": { \
\"osType\": \"$OS_TYPE\", \
\"securityProfile\": { \
\"securityType\": \"ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey\" \
}, \
\"creationData\": { \
\"createOption\": \"FromImage\", \
\"galleryImageReference\": { \
\"id\": \"${sig_resource_id}\" \
} \
} \
} \
}"
else
az resource create --id $disk_resource_id --is-full-object --location $LOCATION --properties "{\"location\": \"$LOCATION\", \
\"properties\": { \
Expand All @@ -85,7 +100,7 @@ capture_benchmark "${SCRIPT_NAME}_convert_image_version_to_disk"

echo "Granting access to $disk_resource_id for 1 hour"
# shellcheck disable=SC2102
sas=$(az disk grant-access --ids $disk_resource_id --duration-in-seconds 3600 --query [accessSas] -o tsv)
sas=$(az disk grant-access --ids $disk_resource_id --duration-in-seconds 3600 --query [accessSAS] -o tsv)
capture_benchmark "${SCRIPT_NAME}_grant_access_to_disk"

echo "Uploading $disk_resource_id to ${CLASSIC_BLOB}/${CAPTURED_SIG_VERSION}.vhd"
Expand Down
9 changes: 8 additions & 1 deletion vhdbuilder/packer/init-variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ if [ "$MODE" == "linuxVhdMode" ] && [ -z "${PACKER_BUILD_LOCATION}" ]; then
exit 1
fi

if [ "${IMG_SKU,,}" == "20_04-lts-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

# Currently only used for linux builds. This determines the environment in which the build is running (either prod or test).
# Used to construct the name of the resource group in which the 1ES pool the build is running on lives in, which also happens.
# to be the resource group in which the packer VNET lives in.
Expand Down Expand Up @@ -167,6 +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"
fi
echo "No input for SIG_IMAGE_NAME was provided, defaulting to: ${SIG_IMAGE_NAME}"
else
Expand Down Expand Up @@ -259,7 +266,7 @@ if [[ "$MODE" == "linuxVhdMode" || "$MODE" == "windowsVhdMode" ]]; then
if [[ ${ARCHITECTURE,,} == "arm64" ]]; then
TARGET_COMMAND_STRING+="--architecture Arm64"
elif [[ ${IMG_SKU} == "20_04-lts-cvm" ]]; then
TARGET_COMMAND_STRING+="--features SecurityType=ConfidentialVMSupported"
TARGET_COMMAND_STRING+="--os-state Specialized --features SecurityType=ConfidentialVM"
fi

az sig image-definition create \
Expand Down
30 changes: 6 additions & 24 deletions vhdbuilder/packer/pre-install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,14 @@ else
set -x
fi

# Run apt get update to refresh repo list
# Run apt dist get upgrade to install packages/kernels

# CVM breaks on kernel image updates due to nullboot package post-install.
# it relies on boot measurements from real tpm hardware.
# building on a real CVM would solve this, but packer doesn't support it.
# we could make upstream changes but that takes time, and we are broken now.
# so we just hold the kernel image packages for now on CVM.
# this still allows us base image and package updates on a weekly cadence.
if [[ "$IMG_SKU" != "20_04-lts-cvm" ]]; then
# Canonical snapshot is only implemented for 20.04 LTS, 22.04 LTS and 23.10 and above
# For 20.04, the only SKUs we support are FIPS, and it reaches out to ESM to get the packages, ESM does not have canonical snapshot support
# Therefore keeping this to 22.04 only for now
if [[ -n "${VHD_BUILD_TIMESTAMP}" && "${OS_VERSION}" == "22.04" ]]; then
sed -i "s#http://azure.archive.ubuntu.com/ubuntu/#https://snapshot.ubuntu.com/ubuntu/${VHD_BUILD_TIMESTAMP}#g" /etc/apt/sources.list
fi
apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT
apt_get_dist_upgrade || exit $ERR_APT_DIST_UPGRADE_TIMEOUT
if [[ -n "${VHD_BUILD_TIMESTAMP}" && "${OS_VERSION}" == "22.04" ]]; then
sed -i "s#http://azure.archive.ubuntu.com/ubuntu/#https://snapshot.ubuntu.com/ubuntu/${VHD_BUILD_TIMESTAMP}#g" /etc/apt/sources.list
fi

if [[ "$IMG_SKU" == "20_04-lts-cvm" ]]; then
# Can not currently update kernel in CVM builds due to nullboot post-installation failure when no TPM is present on the VM
# But we can at least update/install the below packages
apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT
apt-get -y install libpython3.8 python3.8-minimal libpython3.8-minimal libpython3.8-stdlib python3.8 libglib2.0-0 libglib2.0-data libglib2.0-bin python3-urllib3 libpython2.7-stdlib libpython2.7-stdlib python2.7-minimal libpython2.7-minimal nano libarchive13
fi
# Run apt get update to refresh repo list
# Run apt dist get upgrade to install packages/kernels
apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT
apt_get_dist_upgrade || exit $ERR_APT_DIST_UPGRADE_TIMEOUT

if [[ "${ENABLE_FIPS,,}" == "true" ]]; then
# This is FIPS Install for Ubuntu, it purges non FIPS Kernel and attaches UA FIPS Updates
Expand Down
5 changes: 5 additions & 0 deletions vhdbuilder/packer/test/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ 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
# 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

if [ "${OS_TYPE,,}" == "linux" ]; then
# in linux mode, explicitly create the NIC referencing the existing packer subnet to be attached to the testing VM so we avoid creating ephemeral vnets
PACKER_SUBNET_ID="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${PACKER_VNET_RESOURCE_GROUP_NAME}/providers/Microsoft.Network/virtualNetworks/${PACKER_VNET_NAME}/subnets/packer"
Expand Down
Loading

0 comments on commit d99dec0

Please sign in to comment.