From ffb21b4ea2c7ccbb6c3fb01c234b8d27ced68acc Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Mon, 26 Oct 2026 17:24:59 -0700 Subject: [PATCH 01/11] feat: oras migrate to dalec built Signed-off-by: Xinhe Li --- parts/common/components.json | 150 +++++++++++++++------- vhdbuilder/packer/install-dependencies.sh | 11 +- 2 files changed, 114 insertions(+), 47 deletions(-) diff --git a/parts/common/components.json b/parts/common/components.json index 4f890b2dac7..5e112856fd6 100644 --- a/parts/common/components.json +++ b/parts/common/components.json @@ -773,7 +773,7 @@ "downloadURL": "mcr.microsoft.com/aks/aks-gpu-grid-v20:*", "gpuVersion": { "renovateTag": "registry=https://mcr.microsoft.com, name=aks/aks-gpu-grid-v20", - "latestVersion": "595.91.07-20260917204440" + "latestVersion": "595.91.07-20260917204440" } } ], @@ -937,7 +937,49 @@ "downloadURL": "https://github.com/oras-project/oras/releases/download/v${version}/oras_${version}_linux_${CPU_ARCH}.tar.gz" } }, + "ubuntu": { + "r2604": { + "versionsV2": [ + { + "renovateTag": "name=oras, repository=production, os=ubuntu, release=26.04", + "latestVersion": "1.3.5" + } + ] + }, + "r2404": { + "versionsV2": [ + { + "renovateTag": "name=oras, repository=production, os=ubuntu, release=24.04", + "latestVersion": "1.3.5" + } + ] + }, + "r2204": { + "versionsV2": [ + { + "renovateTag": "name=oras, repository=production, os=ubuntu, release=22.04", + "latestVersion": "1.3.5" + } + ] + }, + "r2004": { + "versionsV2": [ + { + "renovateTag": "name=oras, repository=production, os=ubuntu, release=20.04", + "latestVersion": "1.3.5" + } + ] + } + }, "azurelinux": { + "v3.0": { + "versionsV2": [ + { + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=oras, os=azurelinux, release=3.0", + "latestVersion": "1.3.5" + } + ] + }, "OSGUARD/v3.0": { "versionsV2": [ { @@ -951,11 +993,11 @@ "default": { "versionsV2": [ { - "renovateTag": "github-releases=oras-project/oras", - "latestVersion": "1.3.5" + "renovateTag": "", + "latestVersion": "1.3.5-2" } ], - "downloadURL": "https://github.com/oras-project/oras/releases/download/v${version}/oras_${version}_windows_amd64.zip" + "downloadURL": "https://packages.aks.azure.com/dalec-packages/oras/$($version.Split('-')[0])/windows/amd64/oras_${version}_amd64.zip" } } } @@ -2264,36 +2306,46 @@ }, "ubuntu": { "r2004": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=20.04", - "latestVersion": "0.8.25" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=20.04", + "latestVersion": "0.8.25" + } + ] }, "r2204": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=22.04", - "latestVersion": "0.8.25" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=22.04", + "latestVersion": "0.8.25" + } + ] }, "r2404": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=24.04", - "latestVersion": "0.8.25" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=24.04", + "latestVersion": "0.8.25" + } + ] }, "r2604": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=26.04", - "latestVersion": "0.8.25" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=26.04", + "latestVersion": "0.8.25" + } + ] } }, "azurelinux": { "v3.0": { - "versionsV2": [{ - "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=node-problem-detector-kubernetes, os=azurelinux, release=3.0", - "latestVersion": "0.8.25" - }] + "versionsV2": [ + { + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=node-problem-detector-kubernetes, os=azurelinux, release=3.0", + "latestVersion": "0.8.25" + } + ] }, "OSGUARD/v3.0": { "versionsV2": [] @@ -2312,36 +2364,46 @@ }, "ubuntu": { "r2004": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=20.04", - "latestVersion": "1.0.0" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=20.04", + "latestVersion": "1.0.0" + } + ] }, "r2204": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=22.04", - "latestVersion": "1.0.0" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=22.04", + "latestVersion": "1.0.0" + } + ] }, "r2404": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", - "latestVersion": "1.0.0" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", + "latestVersion": "1.0.0" + } + ] }, "r2604": { - "versionsV2": [{ - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", - "latestVersion": "1.0.0" - }] + "versionsV2": [ + { + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", + "latestVersion": "1.0.0" + } + ] } }, "azurelinux": { "v3.0": { - "versionsV2": [{ - "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/ms-oss/x86_64/repodata, name=node-problem-detector-aks-config, os=azurelinux, release=3.0", - "latestVersion": "1.0.0" - }] + "versionsV2": [ + { + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/ms-oss/x86_64/repodata, name=node-problem-detector-aks-config, os=azurelinux, release=3.0", + "latestVersion": "1.0.0" + } + ] }, "OSGUARD/v3.0": { "versionsV2": [] diff --git a/vhdbuilder/packer/install-dependencies.sh b/vhdbuilder/packer/install-dependencies.sh index 04e900e45e8..e64ec059e53 100644 --- a/vhdbuilder/packer/install-dependencies.sh +++ b/vhdbuilder/packer/install-dependencies.sh @@ -593,9 +593,14 @@ cachePackageAndBinaryComponents() { ;; "oras") for version in ${PACKAGE_VERSIONS[@]}; do - evaluatedURL=$(evalPackageDownloadURL ${PACKAGE_DOWNLOAD_URL}) - installOras "${downloadDir}" "${evaluatedURL}" "${version}" - echo " - oras version ${version}" >> ${VHD_LOGS_FILEPATH} + if isMarinerOrAzureLinux || isUbuntu; then + downloadPkgFromVersion "${name}" "${version}" "${downloadDir}" + cacheVersionedKubernetesPackageBinary "${name}" "${version}" "${downloadDir}" || exit $ERR_ORAS_DOWNLOAD_ERROR + elif isFlatcar || isACL "$OS" "$OS_VARIANT"; then + evaluatedURL=$(evalPackageDownloadURL ${PACKAGE_DOWNLOAD_URL}) + installOras "${downloadDir}" "${evaluatedURL}" "${version}" + fi + echo " - ${name} version ${version}" >> ${VHD_LOGS_FILEPATH} done ;; "aks-secure-tls-bootstrap-client") From 47ad1959a482e2fdd60f4a97b6c35f28aed179b2 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Mon, 26 Oct 2026 17:35:00 -0700 Subject: [PATCH 02/11] add one comment Signed-off-by: Xinhe Li --- vhdbuilder/packer/install-dependencies.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/vhdbuilder/packer/install-dependencies.sh b/vhdbuilder/packer/install-dependencies.sh index e64ec059e53..cc8fdf7038a 100644 --- a/vhdbuilder/packer/install-dependencies.sh +++ b/vhdbuilder/packer/install-dependencies.sh @@ -597,6 +597,7 @@ cachePackageAndBinaryComponents() { downloadPkgFromVersion "${name}" "${version}" "${downloadDir}" cacheVersionedKubernetesPackageBinary "${name}" "${version}" "${downloadDir}" || exit $ERR_ORAS_DOWNLOAD_ERROR elif isFlatcar || isACL "$OS" "$OS_VARIANT"; then + # TODO: keep legacy behavior for flatcar and ACL evaluatedURL=$(evalPackageDownloadURL ${PACKAGE_DOWNLOAD_URL}) installOras "${downloadDir}" "${evaluatedURL}" "${version}" fi From 208333b57b74deae5d36645e9072293caf75abd1 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Tue, 27 Oct 2026 05:26:26 +0100 Subject: [PATCH 03/11] Fix ORAS dalec install paths on Linux and Windows Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- vhdbuilder/packer/install-dependencies.sh | 3 ++ .../windows/components_json_helpers.ps1 | 38 +++++++++++++++++++ .../windows/components_json_helpers.tests.ps1 | 14 +++++++ .../packer/windows/configure-windows-vhd.ps1 | 11 +++++- .../windows/windows-vhd-configuration.ps1 | 1 + 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/vhdbuilder/packer/install-dependencies.sh b/vhdbuilder/packer/install-dependencies.sh index cc8fdf7038a..7c75de4d869 100644 --- a/vhdbuilder/packer/install-dependencies.sh +++ b/vhdbuilder/packer/install-dependencies.sh @@ -596,6 +596,9 @@ cachePackageAndBinaryComponents() { if isMarinerOrAzureLinux || isUbuntu; then downloadPkgFromVersion "${name}" "${version}" "${downloadDir}" cacheVersionedKubernetesPackageBinary "${name}" "${version}" "${downloadDir}" || exit $ERR_ORAS_DOWNLOAD_ERROR + version_no_epoch="${version#*:}" + oras_version="${version_no_epoch%%-*}" + ln -sf "/opt/bin/${name}-${oras_version}" "/opt/bin/${name}" || exit $ERR_ORAS_DOWNLOAD_ERROR elif isFlatcar || isACL "$OS" "$OS_VARIANT"; then # TODO: keep legacy behavior for flatcar and ACL evaluatedURL=$(evalPackageDownloadURL ${PACKAGE_DOWNLOAD_URL}) diff --git a/vhdbuilder/packer/windows/components_json_helpers.ps1 b/vhdbuilder/packer/windows/components_json_helpers.ps1 index e3844df7021..daddd0acb5f 100644 --- a/vhdbuilder/packer/windows/components_json_helpers.ps1 +++ b/vhdbuilder/packer/windows/components_json_helpers.ps1 @@ -304,6 +304,44 @@ function GetWindowsPackageVersionFromComponentsJson { throw "Could not find package '$packageName' in components.json" } +function GetWindowsPackageDownloadUrlFromComponentsJson { + Param( + [Parameter(Mandatory = $true)][Object] + $componentsJsonContent, + + [Parameter(Mandatory = $true)][String] + $packageName + ) + + foreach ($package in $componentsJsonContent.Packages) { + if ($package.name -ne $packageName) { + continue + } + + $part = GetWindowsDownloadPartForPackage $package + if ($null -eq $part -or $null -eq $part.versionsV2 -or $part.versionsV2.Count -eq 0) { + throw "Could not find Windows versions for package '$packageName' in components.json" + } + + $downloadUrl = $part.windowsDownloadUrl + if ($null -eq $downloadUrl -or $downloadUrl -eq "") { + $downloadUrl = $part.downloadUrl + } + if ($null -eq $downloadUrl -or $downloadUrl -eq "") { + throw "Could not find a valid Windows download URL for package '$packageName' in components.json" + } + + $latestVersion = $part.versionsV2[0].latestVersion + if ([string]::IsNullOrEmpty($latestVersion) -or $latestVersion -eq "") { + throw "Could not find a valid Windows version for package '$packageName' in components.json" + } + + return ReplaceVarsInUrl -versionString $latestVersion -stringToReplace $downloadUrl + } + + throw "Could not find package '$packageName' in components.json" +} + function GetOCIArtifactsFromComponentsJson { Param( diff --git a/vhdbuilder/packer/windows/components_json_helpers.tests.ps1 b/vhdbuilder/packer/windows/components_json_helpers.tests.ps1 index ebc02a52fa1..594b1f4de06 100644 --- a/vhdbuilder/packer/windows/components_json_helpers.tests.ps1 +++ b/vhdbuilder/packer/windows/components_json_helpers.tests.ps1 @@ -821,6 +821,20 @@ Describe 'Gets the Binaries' { $version | Should -Be "1.3.3" } + It 'can resolve Windows package download URL by name' { + $componentsJson.Packages[0] | Add-Member -NotePropertyName "name" -NotePropertyValue "oras" -Force + $componentsJson.Packages[0].downloadUris.windows.default.versionsV2 = @( + [PSCustomObject]@{ + latestVersion = "1.3.5-2" + } + ) + $componentsJson.Packages[0].downloadUris.windows.default.downloadURL = 'https://packages.aks.azure.com/dalec-packages/oras/${versionNoBuild}/windows/amd64/oras_${version}_amd64.zip' + + $url = GetWindowsPackageDownloadUrlFromComponentsJson $componentsJson "oras" + + $url | Should -Be 'https://packages.aks.azure.com/dalec-packages/oras/1.3.5/windows/amd64/oras_1.3.5-2_amd64.zip' + } + It 'given there are two packages in the same directory, it combines them' { $testString = '{ "Packages": [ diff --git a/vhdbuilder/packer/windows/configure-windows-vhd.ps1 b/vhdbuilder/packer/windows/configure-windows-vhd.ps1 index 3f3725df36c..8e5b8d9d150 100644 --- a/vhdbuilder/packer/windows/configure-windows-vhd.ps1 +++ b/vhdbuilder/packer/windows/configure-windows-vhd.ps1 @@ -245,8 +245,15 @@ function Pull-OCIArtifact throw "Unable to resolve ORAS version from components.json" } - $orasZip = "oras_${orasVersion}_windows_amd64.zip" - $orasUrl = "https://github.com/oras-project/oras/releases/download/v${orasVersion}/${orasZip}" + $orasUrl = $global:orasDownloadUrl + if ([string]::IsNullOrEmpty($orasUrl)) { + throw "Unable to resolve ORAS download URL from components.json" + } + + $orasZip = [System.IO.Path]::GetFileName($orasUrl.Split('?')[0]) + if ([string]::IsNullOrEmpty($orasZip)) { + throw "Unable to resolve ORAS archive name from download URL '$orasUrl'" + } Write-Log "Downloading oras v${orasVersion}" Invoke-WebRequest -UseBasicParsing $orasUrl -OutFile "$global:aksTempDir\$orasZip" diff --git a/vhdbuilder/packer/windows/windows-vhd-configuration.ps1 b/vhdbuilder/packer/windows/windows-vhd-configuration.ps1 index 311fbd2fa48..ab71d3ffc51 100644 --- a/vhdbuilder/packer/windows/windows-vhd-configuration.ps1 +++ b/vhdbuilder/packer/windows/windows-vhd-configuration.ps1 @@ -87,6 +87,7 @@ if (-not ($validSKU -contains $windowsSKU)) # versions synced. $global:defaultContainerdPackageUrl = GetDefaultContainerDFromComponentsJson $componentsJson $global:orasVersion = GetWindowsPackageVersionFromComponentsJson $componentsJson "oras" +$global:orasDownloadUrl = GetWindowsPackageDownloadUrlFromComponentsJson $componentsJson "oras" # defenderUpdateUrl refers to the latest windows defender platform update $global:defenderUpdateUrl = GetDefenderUpdateUrl $windowsSettingsJson From 15c9864fb300337f13a717dc96740a34350074c5 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Tue, 27 Oct 2026 05:32:44 +0100 Subject: [PATCH 04/11] Revert unrelated components.json formatting churn Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- parts/common/components.json | 100 ++++++++++++++--------------------- 1 file changed, 40 insertions(+), 60 deletions(-) diff --git a/parts/common/components.json b/parts/common/components.json index 5e112856fd6..5f0d6ae82de 100644 --- a/parts/common/components.json +++ b/parts/common/components.json @@ -2306,46 +2306,36 @@ }, "ubuntu": { "r2004": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=20.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=20.04", + "latestVersion": "0.8.25" + }] }, "r2204": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=22.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=22.04", + "latestVersion": "0.8.25" + }] }, "r2404": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=24.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=24.04", + "latestVersion": "0.8.25" + }] }, "r2604": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=26.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=26.04", + "latestVersion": "0.8.25" + }] } }, "azurelinux": { "v3.0": { - "versionsV2": [ - { - "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=node-problem-detector-kubernetes, os=azurelinux, release=3.0", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=node-problem-detector-kubernetes, os=azurelinux, release=3.0", + "latestVersion": "0.8.25" + }] }, "OSGUARD/v3.0": { "versionsV2": [] @@ -2364,46 +2354,36 @@ }, "ubuntu": { "r2004": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=20.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=20.04", + "latestVersion": "1.0.0" + }] }, "r2204": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=22.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=22.04", + "latestVersion": "1.0.0" + }] }, "r2404": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", + "latestVersion": "1.0.0" + }] }, "r2604": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", + "latestVersion": "1.0.0" + }] } }, "azurelinux": { "v3.0": { - "versionsV2": [ - { - "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/ms-oss/x86_64/repodata, name=node-problem-detector-aks-config, os=azurelinux, release=3.0", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/ms-oss/x86_64/repodata, name=node-problem-detector-aks-config, os=azurelinux, release=3.0", + "latestVersion": "1.0.0" + }] }, "OSGUARD/v3.0": { "versionsV2": [] From a8f5ab0ace91dd07850d044bcb07fa9bd22e7250 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Tue, 27 Oct 2026 06:51:29 +0100 Subject: [PATCH 05/11] Remove ORAS Ubuntu 20.04 mapping Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- parts/common/components.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/parts/common/components.json b/parts/common/components.json index 5f0d6ae82de..8af77f29f08 100644 --- a/parts/common/components.json +++ b/parts/common/components.json @@ -961,14 +961,6 @@ "latestVersion": "1.3.5" } ] - }, - "r2004": { - "versionsV2": [ - { - "renovateTag": "name=oras, repository=production, os=ubuntu, release=20.04", - "latestVersion": "1.3.5" - } - ] } }, "azurelinux": { From 772fa720d5a5fbacf85acad9bf74a79083ab6d22 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Wed, 28 Oct 2026 01:28:21 -0700 Subject: [PATCH 06/11] contineu Signed-off-by: Xinhe Li --- parts/common/components.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parts/common/components.json b/parts/common/components.json index 5e112856fd6..a792dc9fe26 100644 --- a/parts/common/components.json +++ b/parts/common/components.json @@ -941,7 +941,7 @@ "r2604": { "versionsV2": [ { - "renovateTag": "name=oras, repository=production, os=ubuntu, release=26.04", + "renovateTag": "name=az-oras, repository=production, os=ubuntu, release=26.04", "latestVersion": "1.3.5" } ] @@ -949,7 +949,7 @@ "r2404": { "versionsV2": [ { - "renovateTag": "name=oras, repository=production, os=ubuntu, release=24.04", + "renovateTag": "name=az-oras, repository=production, os=ubuntu, release=24.04", "latestVersion": "1.3.5" } ] @@ -957,7 +957,7 @@ "r2204": { "versionsV2": [ { - "renovateTag": "name=oras, repository=production, os=ubuntu, release=22.04", + "renovateTag": "name=az-oras, repository=production, os=ubuntu, release=22.04", "latestVersion": "1.3.5" } ] @@ -965,7 +965,7 @@ "r2004": { "versionsV2": [ { - "renovateTag": "name=oras, repository=production, os=ubuntu, release=20.04", + "renovateTag": "name=az-oras, repository=production, os=ubuntu, release=20.04", "latestVersion": "1.3.5" } ] From 5095c2ffc45c8d10f66f64167b12868ca5c5e23f Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Thu, 29 Oct 2026 03:38:10 +0100 Subject: [PATCH 07/11] fix: use az-oras package name on Ubuntu for dalec oras PMC publishes oras as 'az-oras' on Ubuntu and 'oras' on Azure Linux; the binary is /usr/bin/oras in both. Add an optional binary_name arg to cacheVersionedKubernetesPackageBinary so the package and binary names can differ. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- vhdbuilder/packer/install-dependencies.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/vhdbuilder/packer/install-dependencies.sh b/vhdbuilder/packer/install-dependencies.sh index 1f9bae86c46..b0295f6b06f 100644 --- a/vhdbuilder/packer/install-dependencies.sh +++ b/vhdbuilder/packer/install-dependencies.sh @@ -251,9 +251,11 @@ cacheVersionedKubernetesPackageBinary() { local package_name=${1} local package_version=${2} local download_dir=${3} + # binary name inside the package, defaults to the package name (e.g. az-oras ships /usr/bin/oras) + local binary_name=${4:-${package_name}} local version_no_epoch local k8s_version - local binary_path="/opt/bin/${package_name}" + local binary_path="/opt/bin/${binary_name}" version_no_epoch="${package_version#*:}" k8s_version="${version_no_epoch%%-*}" @@ -277,13 +279,13 @@ cacheVersionedKubernetesPackageBinary() { return 1 fi - if [ ! -f "${tmp_dir}/usr/bin/${package_name}" ]; then - echo "Failed to find /usr/bin/${package_name} in ${deb_file}" + if [ ! -f "${tmp_dir}/usr/bin/${binary_name}" ]; then + echo "Failed to find /usr/bin/${binary_name} in ${deb_file}" rm -rf "${tmp_dir}" return 1 fi - install -m0755 "${tmp_dir}/usr/bin/${package_name}" "${binary_path}" + install -m0755 "${tmp_dir}/usr/bin/${binary_name}" "${binary_path}" rm -rf "${tmp_dir}" elif isMarinerOrAzureLinux "$OS"; then local rpm_file @@ -294,13 +296,13 @@ cacheVersionedKubernetesPackageBinary() { return 1 fi - rpm2cpio "${rpm_file}" | cpio -i --to-stdout "./usr/bin/${package_name}" "./usr/local/bin/${package_name}" | install -m0755 /dev/stdin "${binary_path}" + rpm2cpio "${rpm_file}" | cpio -i --to-stdout "./usr/bin/${binary_name}" "./usr/local/bin/${binary_name}" | install -m0755 /dev/stdin "${binary_path}" else echo "Skipping versioned binary extraction for unsupported OS ${OS}" return 0 fi - echo " - cached ${package_name} binary at ${binary_path}" >> "${VHD_LOGS_FILEPATH}" + echo " - cached ${binary_name} binary from ${package_name} at ${binary_path}" >> "${VHD_LOGS_FILEPATH}" } # this is for the old package not coming from Dalec, currently fixed at 1.6.2. @@ -783,8 +785,13 @@ cachePackageAndBinaryComponents() { "oras") for version in ${PACKAGE_VERSIONS[@]}; do if isMarinerOrAzureLinux || isUbuntu; then - downloadPkgFromVersion "${name}" "${version}" "${downloadDir}" - cacheVersionedKubernetesPackageBinary "${name}" "${version}" "${downloadDir}" || exit $ERR_ORAS_DOWNLOAD_ERROR + # PMC publishes oras as "az-oras" on Ubuntu and "oras" on Azure Linux; the binary is /usr/bin/oras in both + orasPkgName="${name}" + if isUbuntu; then + orasPkgName="az-oras" + fi + downloadPkgFromVersion "${orasPkgName}" "${version}" "${downloadDir}" + cacheVersionedKubernetesPackageBinary "${orasPkgName}" "${version}" "${downloadDir}" "${name}" || exit $ERR_ORAS_DOWNLOAD_ERROR version_no_epoch="${version#*:}" oras_version="${version_no_epoch%%-*}" ln -sf "/opt/bin/${name}-${oras_version}" "/opt/bin/${name}" || exit $ERR_ORAS_DOWNLOAD_ERROR From 734123ed69d71e584e128b2e01053dbd53002985 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Thu, 29 Oct 2026 07:34:37 +0100 Subject: [PATCH 08/11] fix: fill ORAS dalec migration gaps - add azurelinuxkata v3.0 ORAS entry so kata no longer falls back to the upstream default version - add az-oras/oras to the Renovate revision-stripping rule - add Linux VHD content check for /opt/bin/oras symlink, executable and version with ShellSpec coverage - drop stale oras signature-skip entry in windows-files-check.ps1 - document az-oras package naming in README-COMPONENTS.md - revert unrelated components.json formatting churn Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- .github/renovate.json | 4 +- parts/common/components.json | 112 ++++++++---------- .../cloud-init/artifacts/README-COMPONENTS.md | 2 + .../linux_vhd_content_test_helpers_spec.sh | 59 +++++++++ .../packer/test/linux-vhd-content-test.sh | 51 ++++++++ .../packer/test/windows-files-check.ps1 | 1 - 6 files changed, 166 insertions(+), 63 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index d08c9ad0686..de599c057a4 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -109,6 +109,7 @@ ], "matchPackageNames": [ "aks-secure-tls-bootstrap-client", + "az-oras", "azure-acr-credential-provider", "containernetworking-plugins", "containerd2", @@ -125,7 +126,8 @@ "node-exporter-kubernetes", "node-problem-detector-aks-config", "node-problem-detector-kubernetes", - "nvidia-device-plugin" + "nvidia-device-plugin", + "oras" ], "extractVersion": "^(?:\\d+:)?(?\\d+\\.\\d+\\.\\d+)(?:[-+].*)?$", "versioning": "semver" diff --git a/parts/common/components.json b/parts/common/components.json index 6350b0e9b44..cf1d8b7bf8b 100644 --- a/parts/common/components.json +++ b/parts/common/components.json @@ -757,7 +757,7 @@ "downloadURL": "mcr.microsoft.com/aks/aks-gpu-grid-v20:*", "gpuVersion": { "renovateTag": "registry=https://mcr.microsoft.com, name=aks/aks-gpu-grid-v20", - "latestVersion": "595.91.07-20260917204440" + "latestVersion": "595.91.07-20260917204440" } } ], @@ -964,6 +964,16 @@ ] } }, + "azurelinuxkata": { + "v3.0": { + "versionsV2": [ + { + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=oras, os=azurelinux, release=3.0", + "latestVersion": "1.3.5" + } + ] + } + }, "windows": { "default": { "versionsV2": [ @@ -2295,46 +2305,36 @@ }, "ubuntu": { "r2004": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=20.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=20.04", + "latestVersion": "0.8.25" + }] }, "r2204": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=22.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=22.04", + "latestVersion": "0.8.25" + }] }, "r2404": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=24.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=24.04", + "latestVersion": "0.8.25" + }] }, "r2604": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=26.04", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-kubernetes, repository=production, os=ubuntu, release=26.04", + "latestVersion": "0.8.25" + }] } }, "azurelinux": { "v3.0": { - "versionsV2": [ - { - "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=node-problem-detector-kubernetes, os=azurelinux, release=3.0", - "latestVersion": "0.8.25" - } - ] + "versionsV2": [{ + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/cloud-native/x86_64/repodata, name=node-problem-detector-kubernetes, os=azurelinux, release=3.0", + "latestVersion": "0.8.25" + }] }, "OSGUARD/v3.0": { "versionsV2": [] @@ -2353,46 +2353,36 @@ }, "ubuntu": { "r2004": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=20.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=20.04", + "latestVersion": "1.0.0" + }] }, "r2204": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=22.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=22.04", + "latestVersion": "1.0.0" + }] }, "r2404": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", + "latestVersion": "1.0.0" + }] }, "r2604": { - "versionsV2": [ - { - "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "name=node-problem-detector-aks-config, repository=production, os=ubuntu, release=24.04", + "latestVersion": "1.0.0" + }] } }, "azurelinux": { "v3.0": { - "versionsV2": [ - { - "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/ms-oss/x86_64/repodata, name=node-problem-detector-aks-config, os=azurelinux, release=3.0", - "latestVersion": "1.0.0" - } - ] + "versionsV2": [{ + "renovateTag": "RPM_registry=https://packages.microsoft.com/azurelinux/3.0/prod/ms-oss/x86_64/repodata, name=node-problem-detector-aks-config, os=azurelinux, release=3.0", + "latestVersion": "1.0.0" + }] }, "OSGUARD/v3.0": { "versionsV2": [] diff --git a/parts/linux/cloud-init/artifacts/README-COMPONENTS.md b/parts/linux/cloud-init/artifacts/README-COMPONENTS.md index feb4f8fbd9f..e84b651738a 100644 --- a/parts/linux/cloud-init/artifacts/README-COMPONENTS.md +++ b/parts/linux/cloud-init/artifacts/README-COMPONENTS.md @@ -217,6 +217,8 @@ Trivy uses one `TRIVY_PMC_VERSION` in `trivy-scan.sh` for Ubuntu and Azure Linux Each resolution is logged as `requested -> full package version` and written to the VHD release notes. The release notes also include the distro's complete installed-package inventory; explicit resolution entries cover packages that are cached or unpacked without being registered as installed packages. +ORAS uses DALEC-built PMC packages on Ubuntu 20.04, 22.04, 24.04, and 26.04 and Azure Linux 3.0. The Ubuntu package is named `az-oras` (to avoid conflicting with Ubuntu's own `oras` package) but provides the `oras` executable; the VHD build extracts it to `/opt/bin/oras-` and symlinks `/opt/bin/oras`. Windows uses the DALEC ZIP, and Flatcar/ACL continue to use the upstream release archive. + ## Can I keep only 1 patch version? Yes. Just place the latest version of the component in `latestVersion`. `previousLatestVersion` is optional. diff --git a/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh b/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh index 8d0d025b5cf..9f24df47d88 100644 --- a/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh +++ b/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh @@ -305,4 +305,63 @@ Describe 'testCronPermissions invocation' The output should include "checkPathDoesNotExist:/etc/cron.deny" The output should not include "testCronPermissions: Skipping cron file check" End + + Describe 'testOrasBinaryInstalled helper function' + BeforeAll "eval \"\$(sed -n '/^testOrasBinaryInstalled()/,/^}/p' './vhdbuilder/packer/test/linux-vhd-content-test.sh')\"" + + err() { + printf '%s:%s\n' "$1" "$2" >&2 + } + + create_fake_oras() { + local path="$1" + local version="$2" + printf '#!/bin/bash\nif [ "$1" = "version" ]; then\n echo "Version: %s"\n exit 0\nfi\nexit 1\n' "$version" > "$path" + chmod +x "$path" + } + + It 'passes when unversioned oras symlink points to the expected executable and version' + root_dir="${SHELLSPEC_WORKDIR}/oras-ok" + mkdir -p "$root_dir" + create_fake_oras "$root_dir/oras-1.3.5" "1.3.5" + ln -sf "$root_dir/oras-1.3.5" "$root_dir/oras" + + When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" + The status should equal 0 + The error should equal "" + End + + It 'fails when the unversioned oras symlink is missing' + root_dir="${SHELLSPEC_WORKDIR}/oras-missing-symlink" + mkdir -p "$root_dir" + create_fake_oras "$root_dir/oras-1.3.5" "1.3.5" + + When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" + The status should equal 1 + The error should include "is expected to be a symlink" + End + + It 'fails when the unversioned oras symlink points to the wrong target' + root_dir="${SHELLSPEC_WORKDIR}/oras-bad-target" + mkdir -p "$root_dir" + create_fake_oras "$root_dir/oras-1.3.5" "1.3.5" + create_fake_oras "$root_dir/oras-1.3.4" "1.3.4" + ln -sf "$root_dir/oras-1.3.4" "$root_dir/oras" + + When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" + The status should equal 1 + The error should include "points to" + End + + It 'fails when oras reports an unexpected upstream version' + root_dir="${SHELLSPEC_WORKDIR}/oras-version-mismatch" + mkdir -p "$root_dir" + create_fake_oras "$root_dir/oras-1.3.5" "1.3.4" + ln -sf "$root_dir/oras-1.3.5" "$root_dir/oras" + + When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" + The status should equal 1 + The error should include "oras version mismatch" + End + End End diff --git a/vhdbuilder/packer/test/linux-vhd-content-test.sh b/vhdbuilder/packer/test/linux-vhd-content-test.sh index be3932f7019..870e3669ba0 100644 --- a/vhdbuilder/packer/test/linux-vhd-content-test.sh +++ b/vhdbuilder/packer/test/linux-vhd-content-test.sh @@ -233,6 +233,54 @@ testAcrCredentialProviderInstalled() { echo "$test:Finish" } +testOrasBinaryInstalled() { + local expectedVersion="$1" + local orasPathOverride="${2:-}" + local versionedPathOverride="${3:-}" + local test="testOrasBinaryInstalled" + local versionNoEpoch upstreamVersion + local orasPath versionedOrasPath + local resolvedSymlink installedVersion + + versionNoEpoch="${expectedVersion#*:}" + upstreamVersion="${versionNoEpoch%%-*}" + orasPath="${orasPathOverride:-/opt/bin/oras}" + versionedOrasPath="${versionedPathOverride:-/opt/bin/oras-${upstreamVersion}}" + + if [ ! -x "${versionedOrasPath}" ]; then + err "$test" "expected executable ${versionedOrasPath} is missing or not executable" + return 1 + fi + + if [ ! -L "${orasPath}" ]; then + err "$test" "${orasPath} is expected to be a symlink to ${versionedOrasPath}" + return 1 + fi + + resolvedSymlink=$(readlink "${orasPath}") + if [ "${resolvedSymlink}" != "${versionedOrasPath}" ]; then + err "$test" "${orasPath} points to ${resolvedSymlink}; expected ${versionedOrasPath}" + return 1 + fi + + if [ ! -x "${orasPath}" ]; then + err "$test" "${orasPath} is not executable" + return 1 + fi + + installedVersion=$("${orasPath}" version 2>/dev/null | awk -F': *' '/^Version:/ {print $2; exit}') + if [ -z "${installedVersion}" ]; then + err "$test" "unable to parse oras version from ${orasPath} version output" + return 1 + fi + if [ "${installedVersion}" != "${upstreamVersion}" ]; then + err "$test" "oras version mismatch, expected ${upstreamVersion} but found ${installedVersion}" + return 1 + fi + + return 0 +} + testPackagesInstalled() { local test="testPackagesInstalled" CPU_ARCH=$(getCPUArch) # "arm64" or "amd64" @@ -322,6 +370,9 @@ testPackagesInstalled() { esac testContainerd "$version" "$pkgName" ;; + "oras") + testOrasBinaryInstalled "$version" + ;; esac break diff --git a/vhdbuilder/packer/test/windows-files-check.ps1 b/vhdbuilder/packer/test/windows-files-check.ps1 index c0e7ac61e55..94d5d4cce86 100644 --- a/vhdbuilder/packer/test/windows-files-check.ps1 +++ b/vhdbuilder/packer/test/windows-files-check.ps1 @@ -21,7 +21,6 @@ $SkipMapForSignature = @{ "aks-windows-cse-scripts-v0.0.32.zip" = @(); "azure-vnet-cni-windows-amd64-v1.6.21.zip" = @(); "azure-vnet-cni-windows-amd64-v1.5.38.zip" = @(); - "oras_1.3.6_windows_amd64.zip" = @(); } # $SkipSignatureCheckForBinaries is defined in windows-vhd-configuration.ps1 (dot-sourced above) From 7b2db76336545399bb0ac6a8f9cbb2f2b59f24ac Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Thu, 29 Oct 2026 09:06:34 +0100 Subject: [PATCH 09/11] chore: revert unnecessary log message changes in install-dependencies.sh Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- vhdbuilder/packer/install-dependencies.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vhdbuilder/packer/install-dependencies.sh b/vhdbuilder/packer/install-dependencies.sh index b0295f6b06f..6664c2892c7 100644 --- a/vhdbuilder/packer/install-dependencies.sh +++ b/vhdbuilder/packer/install-dependencies.sh @@ -280,7 +280,7 @@ cacheVersionedKubernetesPackageBinary() { fi if [ ! -f "${tmp_dir}/usr/bin/${binary_name}" ]; then - echo "Failed to find /usr/bin/${binary_name} in ${deb_file}" + echo "Failed to find /usr/bin/${package_name} in ${deb_file}" rm -rf "${tmp_dir}" return 1 fi @@ -302,7 +302,7 @@ cacheVersionedKubernetesPackageBinary() { return 0 fi - echo " - cached ${binary_name} binary from ${package_name} at ${binary_path}" >> "${VHD_LOGS_FILEPATH}" + echo " - cached ${package_name} binary at ${binary_path}" >> "${VHD_LOGS_FILEPATH}" } # this is for the old package not coming from Dalec, currently fixed at 1.6.2. @@ -800,7 +800,7 @@ cachePackageAndBinaryComponents() { evaluatedURL=$(evalPackageDownloadURL ${PACKAGE_DOWNLOAD_URL}) installOras "${downloadDir}" "${evaluatedURL}" "${version}" fi - echo " - ${name} version ${version}" >> ${VHD_LOGS_FILEPATH} + echo " - oras version ${version}" >> ${VHD_LOGS_FILEPATH} done ;; "aks-secure-tls-bootstrap-client") From bd09465b0f6cfef70c3bd6eb89749200ca580fb1 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Thu, 29 Oct 2026 09:08:43 +0100 Subject: [PATCH 10/11] fix: accept DALEC build metadata in oras VHD version check DALEC-built oras reports versions like 1.3.5+ubuntu.24.04; strip the +metadata before comparing. Also silence SC2016 in the spec helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- .../test/linux_vhd_content_test_helpers_spec.sh | 12 ++++++++++++ vhdbuilder/packer/test/linux-vhd-content-test.sh | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh b/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh index 9f24df47d88..41c1d4025b0 100644 --- a/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh +++ b/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh @@ -316,6 +316,7 @@ Describe 'testCronPermissions invocation' create_fake_oras() { local path="$1" local version="$2" + # shellcheck disable=SC2016 # $1 must stay literal in the generated script printf '#!/bin/bash\nif [ "$1" = "version" ]; then\n echo "Version: %s"\n exit 0\nfi\nexit 1\n' "$version" > "$path" chmod +x "$path" } @@ -331,6 +332,17 @@ Describe 'testCronPermissions invocation' The error should equal "" End + It 'passes when DALEC oras reports build metadata in its version' + root_dir="${SHELLSPEC_WORKDIR}/oras-dalec-build-metadata" + mkdir -p "$root_dir" + create_fake_oras "$root_dir/oras-1.3.5" "1.3.5+ubuntu.24.04" + ln -sf "$root_dir/oras-1.3.5" "$root_dir/oras" + + When call testOrasBinaryInstalled "1.3.5" "$root_dir/oras" "$root_dir/oras-1.3.5" + The status should equal 0 + The error should equal "" + End + It 'fails when the unversioned oras symlink is missing' root_dir="${SHELLSPEC_WORKDIR}/oras-missing-symlink" mkdir -p "$root_dir" diff --git a/vhdbuilder/packer/test/linux-vhd-content-test.sh b/vhdbuilder/packer/test/linux-vhd-content-test.sh index 870e3669ba0..f4256aafadc 100644 --- a/vhdbuilder/packer/test/linux-vhd-content-test.sh +++ b/vhdbuilder/packer/test/linux-vhd-content-test.sh @@ -273,7 +273,8 @@ testOrasBinaryInstalled() { err "$test" "unable to parse oras version from ${orasPath} version output" return 1 fi - if [ "${installedVersion}" != "${upstreamVersion}" ]; then + # DALEC builds append build metadata, e.g. "1.3.5+ubuntu.24.04" + if [ "${installedVersion%%+*}" != "${upstreamVersion}" ]; then err "$test" "oras version mismatch, expected ${upstreamVersion} but found ${installedVersion}" return 1 fi From 86573776548af0993d242a608e33f22c9b4a6769 Mon Sep 17 00:00:00 2001 From: Xinhe Li Date: Thu, 29 Oct 2026 11:13:58 +0100 Subject: [PATCH 11/11] refactor: install oras via existing PMC package helpers Use installPackageFromCache/installRPMPackageFromFile instead of extending cacheVersionedKubernetesPackageBinary, which is now unchanged from main. oras is installed directly to /opt/bin/oras; OS entries with a downloadURL keep the upstream archive path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xinhe Li --- .../linux_vhd_content_test_helpers_spec.sh | 38 ++++++------------- vhdbuilder/packer/install-dependencies.sh | 32 +++++++--------- .../packer/test/linux-vhd-content-test.sh | 27 ++----------- 3 files changed, 27 insertions(+), 70 deletions(-) diff --git a/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh b/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh index 41c1d4025b0..979d7ce5364 100644 --- a/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh +++ b/spec/vhdbuilder/packer/test/linux_vhd_content_test_helpers_spec.sh @@ -321,13 +321,12 @@ Describe 'testCronPermissions invocation' chmod +x "$path" } - It 'passes when unversioned oras symlink points to the expected executable and version' + It 'passes when oras is installed with the expected version' root_dir="${SHELLSPEC_WORKDIR}/oras-ok" mkdir -p "$root_dir" - create_fake_oras "$root_dir/oras-1.3.5" "1.3.5" - ln -sf "$root_dir/oras-1.3.5" "$root_dir/oras" + create_fake_oras "$root_dir/oras" "1.3.5" - When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" + When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" The status should equal 0 The error should equal "" End @@ -335,43 +334,28 @@ Describe 'testCronPermissions invocation' It 'passes when DALEC oras reports build metadata in its version' root_dir="${SHELLSPEC_WORKDIR}/oras-dalec-build-metadata" mkdir -p "$root_dir" - create_fake_oras "$root_dir/oras-1.3.5" "1.3.5+ubuntu.24.04" - ln -sf "$root_dir/oras-1.3.5" "$root_dir/oras" + create_fake_oras "$root_dir/oras" "1.3.5+ubuntu.24.04" - When call testOrasBinaryInstalled "1.3.5" "$root_dir/oras" "$root_dir/oras-1.3.5" + When call testOrasBinaryInstalled "1.3.5" "$root_dir/oras" The status should equal 0 The error should equal "" End - It 'fails when the unversioned oras symlink is missing' - root_dir="${SHELLSPEC_WORKDIR}/oras-missing-symlink" + It 'fails when oras is missing' + root_dir="${SHELLSPEC_WORKDIR}/oras-missing" mkdir -p "$root_dir" - create_fake_oras "$root_dir/oras-1.3.5" "1.3.5" - When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" + When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" The status should equal 1 - The error should include "is expected to be a symlink" - End - - It 'fails when the unversioned oras symlink points to the wrong target' - root_dir="${SHELLSPEC_WORKDIR}/oras-bad-target" - mkdir -p "$root_dir" - create_fake_oras "$root_dir/oras-1.3.5" "1.3.5" - create_fake_oras "$root_dir/oras-1.3.4" "1.3.4" - ln -sf "$root_dir/oras-1.3.4" "$root_dir/oras" - - When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" - The status should equal 1 - The error should include "points to" + The error should include "is missing or not executable" End It 'fails when oras reports an unexpected upstream version' root_dir="${SHELLSPEC_WORKDIR}/oras-version-mismatch" mkdir -p "$root_dir" - create_fake_oras "$root_dir/oras-1.3.5" "1.3.4" - ln -sf "$root_dir/oras-1.3.5" "$root_dir/oras" + create_fake_oras "$root_dir/oras" "1.3.4" - When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" "$root_dir/oras-1.3.5" + When call testOrasBinaryInstalled "1.3.5-2" "$root_dir/oras" The status should equal 1 The error should include "oras version mismatch" End diff --git a/vhdbuilder/packer/install-dependencies.sh b/vhdbuilder/packer/install-dependencies.sh index 6664c2892c7..79f6687bb60 100644 --- a/vhdbuilder/packer/install-dependencies.sh +++ b/vhdbuilder/packer/install-dependencies.sh @@ -251,11 +251,9 @@ cacheVersionedKubernetesPackageBinary() { local package_name=${1} local package_version=${2} local download_dir=${3} - # binary name inside the package, defaults to the package name (e.g. az-oras ships /usr/bin/oras) - local binary_name=${4:-${package_name}} local version_no_epoch local k8s_version - local binary_path="/opt/bin/${binary_name}" + local binary_path="/opt/bin/${package_name}" version_no_epoch="${package_version#*:}" k8s_version="${version_no_epoch%%-*}" @@ -279,13 +277,13 @@ cacheVersionedKubernetesPackageBinary() { return 1 fi - if [ ! -f "${tmp_dir}/usr/bin/${binary_name}" ]; then + if [ ! -f "${tmp_dir}/usr/bin/${package_name}" ]; then echo "Failed to find /usr/bin/${package_name} in ${deb_file}" rm -rf "${tmp_dir}" return 1 fi - install -m0755 "${tmp_dir}/usr/bin/${binary_name}" "${binary_path}" + install -m0755 "${tmp_dir}/usr/bin/${package_name}" "${binary_path}" rm -rf "${tmp_dir}" elif isMarinerOrAzureLinux "$OS"; then local rpm_file @@ -296,7 +294,7 @@ cacheVersionedKubernetesPackageBinary() { return 1 fi - rpm2cpio "${rpm_file}" | cpio -i --to-stdout "./usr/bin/${binary_name}" "./usr/local/bin/${binary_name}" | install -m0755 /dev/stdin "${binary_path}" + rpm2cpio "${rpm_file}" | cpio -i --to-stdout "./usr/bin/${package_name}" "./usr/local/bin/${package_name}" | install -m0755 /dev/stdin "${binary_path}" else echo "Skipping versioned binary extraction for unsupported OS ${OS}" return 0 @@ -784,19 +782,15 @@ cachePackageAndBinaryComponents() { ;; "oras") for version in ${PACKAGE_VERSIONS[@]}; do - if isMarinerOrAzureLinux || isUbuntu; then - # PMC publishes oras as "az-oras" on Ubuntu and "oras" on Azure Linux; the binary is /usr/bin/oras in both - orasPkgName="${name}" - if isUbuntu; then - orasPkgName="az-oras" - fi - downloadPkgFromVersion "${orasPkgName}" "${version}" "${downloadDir}" - cacheVersionedKubernetesPackageBinary "${orasPkgName}" "${version}" "${downloadDir}" "${name}" || exit $ERR_ORAS_DOWNLOAD_ERROR - version_no_epoch="${version#*:}" - oras_version="${version_no_epoch%%-*}" - ln -sf "/opt/bin/${name}-${oras_version}" "/opt/bin/${name}" || exit $ERR_ORAS_DOWNLOAD_ERROR - elif isFlatcar || isACL "$OS" "$OS_VARIANT"; then - # TODO: keep legacy behavior for flatcar and ACL + # OS entries without a downloadURL install the DALEC-built PMC package + if [ -z "${PACKAGE_DOWNLOAD_URL}" ] && isUbuntu; then + # The Ubuntu PMC package is named az-oras but ships /usr/bin/oras + downloadPkgFromVersion "az-oras" "${version}" "/opt/${name}/downloads" || exit $ERR_ORAS_DOWNLOAD_ERROR + installPackageFromCache "${name}" "${version}" "/opt/bin/${name}" || exit $ERR_ORAS_DOWNLOAD_ERROR + elif [ -z "${PACKAGE_DOWNLOAD_URL}" ] && isMarinerOrAzureLinux; then + downloadPkgFromVersion "${name}" "${version}" "$(getPackageDownloadDir "${name}")" || exit $ERR_ORAS_DOWNLOAD_ERROR + installRPMPackageFromFile "${name}" "${version}" "/opt/bin/${name}" || exit $ERR_ORAS_DOWNLOAD_ERROR + else evaluatedURL=$(evalPackageDownloadURL ${PACKAGE_DOWNLOAD_URL}) installOras "${downloadDir}" "${evaluatedURL}" "${version}" fi diff --git a/vhdbuilder/packer/test/linux-vhd-content-test.sh b/vhdbuilder/packer/test/linux-vhd-content-test.sh index f4256aafadc..d9864128fec 100644 --- a/vhdbuilder/packer/test/linux-vhd-content-test.sh +++ b/vhdbuilder/packer/test/linux-vhd-content-test.sh @@ -235,36 +235,15 @@ testAcrCredentialProviderInstalled() { testOrasBinaryInstalled() { local expectedVersion="$1" - local orasPathOverride="${2:-}" - local versionedPathOverride="${3:-}" + local orasPath="${2:-/opt/bin/oras}" local test="testOrasBinaryInstalled" - local versionNoEpoch upstreamVersion - local orasPath versionedOrasPath - local resolvedSymlink installedVersion + local versionNoEpoch upstreamVersion installedVersion versionNoEpoch="${expectedVersion#*:}" upstreamVersion="${versionNoEpoch%%-*}" - orasPath="${orasPathOverride:-/opt/bin/oras}" - versionedOrasPath="${versionedPathOverride:-/opt/bin/oras-${upstreamVersion}}" - - if [ ! -x "${versionedOrasPath}" ]; then - err "$test" "expected executable ${versionedOrasPath} is missing or not executable" - return 1 - fi - - if [ ! -L "${orasPath}" ]; then - err "$test" "${orasPath} is expected to be a symlink to ${versionedOrasPath}" - return 1 - fi - - resolvedSymlink=$(readlink "${orasPath}") - if [ "${resolvedSymlink}" != "${versionedOrasPath}" ]; then - err "$test" "${orasPath} points to ${resolvedSymlink}; expected ${versionedOrasPath}" - return 1 - fi if [ ! -x "${orasPath}" ]; then - err "$test" "${orasPath} is not executable" + err "$test" "expected executable ${orasPath} is missing or not executable" return 1 fi