Skip to content

chore: cache oras binary in Windows image#7860

Merged
jiashun0011 merged 1 commit intomainfrom
jiashunliu/oras-cache
Feb 27, 2026
Merged

chore: cache oras binary in Windows image#7860
jiashun0011 merged 1 commit intomainfrom
jiashunliu/oras-cache

Conversation

@jiashun0011
Copy link
Contributor

What this PR does / why we need it:

Cache oras binary in Windows image.

Which issue(s) this PR fixes:

Chore: cache oras binary in Windows image

Copilot AI review requested due to automatic review settings February 12, 2026 07:03
@github-actions github-actions bot added the components This pull request updates cached components on Linux or Windows VHDs label Feb 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Windows support for caching the oras CLI as part of the Windows VHD build cache, by extending the shared components manifest.

Changes:

  • Added windowsDownloadLocation for the oras package.
  • Added a Windows-specific downloadURIs.windows.default entry for oras (v1.2.2).

Comment on lines +976 to +985
"windows": {
"default": {
"versionsV2": [
{
"renovateTag": "<DO_NOT_UPDATE>",
"latestVersion": "1.2.2"
}
],
"downloadURL": "https://github.com/oras-project/oras/releases/download/v${version}/oras_${version}_windows_amd64.zip"
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Windows oras version here (1.2.2) doesn’t match the oras version currently used during Windows VHD build for OCI pulls (vhdbuilder/packer/windows/configure-windows-vhd.ps1 hardcodes 1.2.3). This creates version drift and can result in downloading/storing two different oras zips in a single build (extra time/space) while the cached copy may never be used. Consider aligning the version with what the VHD build uses, and ideally sourcing the oras version from a single place (e.g., components.json) to prevent future divergence.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jiashun0011
found function Pull-OCIArtifact, it hardcode to install v1.2.3 oras and installed seems only in aksTempDir "c:\akstemp". I guess it is not impleted for cse runtime?
cc @abeltrano

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can change the cache version to v1.2.3
and in Pull-OCIArtifact, we modify to detect cached version first, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed version to v1.3.0

{
"name": "oras",
"downloadLocation": "/opt/bin",
"windowsDownloadLocation": "c:\\akse-cache\\oras\\",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

akse-cache will be removed finally.
Do you think we should move the oras.exe to another place to keep it? e.g. c:/aks-tools/oras/oras.exe?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, let's use the future location to avoid problems in the future.

where can I learn more about the deprecation of the akse-cache folder ?

Copy link
Contributor

@fseldow fseldow Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it should happen during NodePrep

if (Test-Path $CacheDir)

i just created on windows node, kubectl enter this node but did not find c:\akse-cache

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I'm aware, we have no plans to remove the aks-cache directory. It's used during node provisioning and it's probably deleted after the node joins the cluster to save drive space.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats ture, it is deleted after the node joins. Is that possible for us to remain oras.exe on the node? because if the node has issue, without this tool, we will hard to troubleshoot network isolated cluster issues

"default": {
"versionsV2": [
{
"renovateTag": "<DO_NOT_UPDATE>",
Copy link
Collaborator

@djsly djsly Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not setting up renovate to fetch the version from github and have automatic PR created for ORAS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's nice and I may modify it in following pr, as first pr, we just want to make sure the oras binrary needed can be cached as expected

Copy link
Contributor

@timmy-wright timmy-wright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. For windows, Oras seems to be only used during VHD creation. It's not needed (as far as I can tell) during node provisioning. So we don't need it cached on the VHD. Ideally it would be used to pull OCI Artifacts and then deleted afterwards.

If we want to update the version, we can do this in the configure-windows-vhd.ps1 file. Currently it's set to 1.2.3. We probably need a better way to specify this, but I don't think components.json is the right place.

@fseldow
Copy link
Contributor

fseldow commented Feb 18, 2026

I'm confused. For windows, Oras seems to be only used during VHD creation. It's not needed (as far as I can tell) during node provisioning. So we don't need it cached on the VHD. Ideally it would be used to pull OCI Artifacts and then deleted afterwards.

If we want to update the version, we can do this in the configure-windows-vhd.ps1 file. Currently it's set to 1.2.3. We probably need a better way to specify this, but I don't think components.json is the right place.

Hi @timmy-wright sorry for confusing, we are onboarding network isolated cluster on windows.
For this feature, we need to use oras to pull OCI artifact (zip binaries) from private acr (one proxy for mcr) instead of packages.aks.microsoft.com (ni cluster has no egress traffic to this).
Thus, oras will be required during node provision, when detect it is ni cluster, binaries like kubelet/kubectl/credential-provider/cni-plugins will be pulled from acr via oras then.

Copy link
Contributor

@fseldow fseldow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@github-actions
Copy link
Contributor

Changes cached containers or packages on windows VHDs

Please get a Windows SIG member to approve.

The following dif file shows any additions or deletions from what will be cached on windows VHDs organised by VHD type.

  • Additions are new things cached.
  • Deletions are things no longer cached.
diff --git a/vhd_files/2022-containerd-gen2.txt b/vhd_files/2022-containerd-gen2.txt
index 9b3f85b..51e063e 100644
--- a/vhd_files/2022-containerd-gen2.txt
+++ b/vhd_files/2022-containerd-gen2.txt
@@ -0,0 +1 @@
+c:\aks-tools\oras\: https://github.com/oras-project/oras/releases/download/v1.3.0/oras_1.3.0_windows_amd64.zip
diff --git a/vhd_files/2022-containerd.txt b/vhd_files/2022-containerd.txt
index 3e69016..8e49978 100644
--- a/vhd_files/2022-containerd.txt
+++ b/vhd_files/2022-containerd.txt
@@ -0,0 +1 @@
+c:\aks-tools\oras\: https://github.com/oras-project/oras/releases/download/v1.3.0/oras_1.3.0_windows_amd64.zip
diff --git a/vhd_files/2025-gen2.txt b/vhd_files/2025-gen2.txt
index dfbde77..d0ebfd3 100644
--- a/vhd_files/2025-gen2.txt
+++ b/vhd_files/2025-gen2.txt
@@ -0,0 +1 @@
+c:\aks-tools\oras\: https://github.com/oras-project/oras/releases/download/v1.3.0/oras_1.3.0_windows_amd64.zip
diff --git a/vhd_files/2025.txt b/vhd_files/2025.txt
index e855749..425cc8c 100644
--- a/vhd_files/2025.txt
+++ b/vhd_files/2025.txt
@@ -0,0 +1 @@
+c:\aks-tools\oras\: https://github.com/oras-project/oras/releases/download/v1.3.0/oras_1.3.0_windows_amd64.zip
diff --git a/vhd_files/23H2-gen2.txt b/vhd_files/23H2-gen2.txt
index 6ab5475..aa86b17 100644
--- a/vhd_files/23H2-gen2.txt
+++ b/vhd_files/23H2-gen2.txt
@@ -0,0 +1 @@
+c:\aks-tools\oras\: https://github.com/oras-project/oras/releases/download/v1.3.0/oras_1.3.0_windows_amd64.zip
diff --git a/vhd_files/23H2.txt b/vhd_files/23H2.txt
index aab7763..4f6ac7c 100644
--- a/vhd_files/23H2.txt
+++ b/vhd_files/23H2.txt
@@ -0,0 +1 @@
+c:\aks-tools\oras\: https://github.com/oras-project/oras/releases/download/v1.3.0/oras_1.3.0_windows_amd64.zip

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

vhdbuilder/packer/test/windows-files-check.ps1:24

  • This skip entry is added for oras_1.3.0_windows_amd64.zip, but it's premature. The file will only be present in the VHD if the package is actually downloaded and cached during VHD build. Currently, the Pull-OCIArtifact function downloads oras 1.2.3 to c:\akstemp\ (not c:\aks-tools\oras), so this 1.3.0 zip file will never be downloaded during the VHD build process unless Pull-OCIArtifact is updated to use the cached version.

This entry should only be added after the integration work is complete and oras 1.3.0 is actually being cached on the VHD.

    "oras_1.3.0_windows_amd64.zip"             = @();

@jiashun0011 jiashun0011 merged commit 65dd734 into main Feb 27, 2026
44 of 45 checks passed
@jiashun0011 jiashun0011 deleted the jiashunliu/oras-cache branch February 27, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

components This pull request updates cached components on Linux or Windows VHDs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants