From db4724477bc13b0524148818ed2396fc01fb7f1c Mon Sep 17 00:00:00 2001 From: Henry Li <69694695+henryli001@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:28:20 -0700 Subject: [PATCH] Onboard NVIDIA Driver Container to PublishContainer script (#9439) Co-authored-by: Henry Li --- .../scripts/PublishContainers.sh | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/.pipelines/containerSourceData/scripts/PublishContainers.sh b/.pipelines/containerSourceData/scripts/PublishContainers.sh index 076dadfb1e..a200cb832b 100755 --- a/.pipelines/containerSourceData/scripts/PublishContainers.sh +++ b/.pipelines/containerSourceData/scripts/PublishContainers.sh @@ -184,8 +184,8 @@ function create_multi_arch_tags { if [[ $architecture_build == *"ARM64"* ]]; then docker manifest create "$full_multiarch_tag" --amend "$original_container-arm64" docker manifest annotate "$full_multiarch_tag" "$original_container-arm64" \ - --os-version "$OS_VERSION_PREFIX$azure_linux_version" \ - --variant "v8" + --os-version "$OS_VERSION_PREFIX$azure_linux_version" \ + --variant "v8" fi echo "+++ push $full_multiarch_tag tag" @@ -231,6 +231,7 @@ do IS_CORE_IMAGE=$(jq -r '.data_is_core_image' "$TEMP_FILE") IS_GOLDEN_IMAGE=$(jq -r '.data_is_golden_image' "$TEMP_FILE") IS_HCI_GOLDEN_IMAGE=$(jq -r '.data_is_hci_golden_image' "$TEMP_FILE") + IS_NVIDIA_GOLDEN_IMAGE=$(jq -r '.data_is_nvidia_golden_image' "$TEMP_FILE") ARCHITECTURE_TO_BUILD=$(jq -r '.data_architecture_to_build' "$TEMP_FILE") TARGET_ACR=$(jq -r '.data_target_acr' "$TEMP_FILE") @@ -242,12 +243,13 @@ do # Remove the temp file. [ -f "$TEMP_FILE" ] && rm "$TEMP_FILE" - echo "Container Type -> $container_type" - echo "IS_CORE_IMAGE -> $IS_CORE_IMAGE" - echo "IS_GOLDEN_IMAGE -> $IS_GOLDEN_IMAGE" - echo "IS_HCI_GOLDEN_IMAGE -> $IS_HCI_GOLDEN_IMAGE" - echo "ARCHITECTURE_TO_BUILD -> $ARCHITECTURE_TO_BUILD" - echo "TARGET_ACR -> $TARGET_ACR" + echo "Container Type -> $container_type" + echo "IS_CORE_IMAGE -> $IS_CORE_IMAGE" + echo "IS_GOLDEN_IMAGE -> $IS_GOLDEN_IMAGE" + echo "IS_HCI_GOLDEN_IMAGE -> $IS_HCI_GOLDEN_IMAGE" + echo "IS_NVIDIA_GOLDEN_IMAGE -> $IS_NVIDIA_GOLDEN_IMAGE" + echo "ARCHITECTURE_TO_BUILD -> $ARCHITECTURE_TO_BUILD" + echo "TARGET_ACR -> $TARGET_ACR" while IFS= read -r image_name do @@ -333,6 +335,21 @@ do "$major_version" \ "$azure_linux_version" \ "$ARCHITECTURE_TO_BUILD" + elif "$IS_NVIDIA_GOLDEN_IMAGE"; then + # For nvidia images, we need to create multi-arch tag for the following format: + # E.g. for azurelinuxpreview.azurecr.io/nvidia/cuda/driver:550-5.15.160.1-1.cm2-mariner2.0.2.0.20240626-amd64 + # the multi-arch tag to create is: azurelinuxpreview.azurecr.io/nvidia/cuda/driver:550-5.15.160.1-1.cm2-mariner2.0 + multiarch_tag=${container_tag%.*.*.*} + + azure_linux_version=$(awk -F '-' '{print $4}' <<< "$container_tag") # 550-5.15.160.1-1.cm2-mariner2.0.2.0.20240626 -> mariner2.0.2.0.20240626 + azure_linux_version=$(awk -F '.' '{print $3"."$4}' <<< "$azure_linux_version") # [mariner2].[0].[2].[0].[20240626] -> 2.0 + # ^ ^ + create_multi_arch_tags \ + "$image_name_with_noarch" \ + "$container_name" \ + "$multiarch_tag" \ + "$azure_linux_version" \ + "$ARCHITECTURE_TO_BUILD" elif "$IS_GOLDEN_IMAGE"; then # For golden images, we need to create multi-arch tags for # the major version, the major and minor version, and the full version.