Skip to content

ACR-based SDK distribution#2837

Open
CodingIsBliss wants to merge 82 commits intomainfrom
feature/oryx-sdk-acr-distribution
Open

ACR-based SDK distribution#2837
CodingIsBliss wants to merge 82 commits intomainfrom
feature/oryx-sdk-acr-distribution

Conversation

@CodingIsBliss
Copy link
Copy Markdown
Collaborator

@CodingIsBliss CodingIsBliss commented Apr 1, 2026

Summary

Multiple ways to pull SDKs from different resources based on environment variables:

  1. ORYX_ENABLE_EXTERNAL_ACR_SDK_PROVIDER
    Oryx -> Socket -> ACR

  2. ORYX_ENABLE_EXTERNAL_SDK_PROVIDER (Existing flow for App Services)
    Oryx -> Socket -> Storage Account

  3. ORYX_ENABLE_ACR_SDK_PROVIDER
    Oryx -> ACR

  4. Oryx -> Storage Account

Priority and Fallback order

  1. Oryx -> Socket -> ACR
  2. Oryx -> Socket -> Storage Account
  3. Oryx -> ACR
  4. Oryx -> Storage Account

Review Guide

Start at DefaultPlatformsInformationProvider.cs → GetPlatformsInfo(). This is the entry point that detects platforms and logs SDK provider status (new). It calls platform.Detect() for each platform.

Follow the flow for each platform:

Python — PythonPlatform.Detect() → ResolveVersions() → GetInstallerScriptSnippet()
PHP — PhpPlatform → InstallPhp() / InstallPhpComposer() (refactored with ACR fallback chain)
Node — NodePlatform → same pattern as Python
DotNet — DotnetCorePlatform → has extra SDK↔Runtime version mapping via compound ACR tags
Key new shared components:

Key new shared components:

AcrSdkProvider.cs — Direct OCI API client (downloads SDK tarballs from ACR)
OciRegistryClient.cs — HTTP client for OCI Distribution API
ExternalAcrSdkProvider.cs / ExternalAcrVersionProviderBase.cs — Socket-based ACR path
Modified existing files:

PlatformInstallerBase.cs → skipSdkBinaryDownload block added for ACR tarball lookup + extraction

Some other points:

  1. PHP uses a different pattern than Python/Node/DotNet
    Python, Node, DotNet: GetInstallerScriptSnippet returns a string — each TryInstall* returns the script or null
    PHP: Uses StringBuilder — each TryInstall* appends directly to the builder and returns bool. This is because PHP installs two things (PHP + Composer) in a single GetInstallerScriptSnippet call
  2. DotNet ACR tags use compound format
    All other platforms: {osFlavor}-{version} (e.g., noble-3.14.3)
    DotNet: {osFlavor}-{sdkVersion}_{runtimeVersion} (e.g., noble-10.0.201_10.0.5) because .NET requires runtime→SDK version mapping. DotNetCoreAcrVersionProvider parses this; AcrSdkProvider passes runtimeVersion as an optional parameter to construct the correct tag
  3. OCI layer unwrapping done in C# (AcrSdkProvider), not bash (PlatformInstallerBase)
    FROM scratch; COPY sdk.tar.gz / produces a layer that wraps the tarball inside a tar
    AcrSdkProvider.ExtractFileFromTar extracts the inner SDK tarball using System.Formats.Tar.TarReader — so by the time PlatformInstallerBase runs, the file at dynamicPath is already the raw SDK tarball, same as what CDN/blob providers produce
  4. Four SDK sources with independent fallback
    Each provider is independent — if one fails, the next is tried without any state leaking
    Order: External-ACR (socket→host→ACR) → External-SDK (socket→host→blob) → Direct-ACR (OCI API) → CDN
    The first two are controlled by the App Service platform; the last two are Oryx-native
  5. Token auth for anonymous ACR
    Even "anonymous pull" ACR registries require a bearer token exchange — OciRegistryClient handles this transparently with per-scope token caching

Testing

With ACR Provider enabled (direct ACR pull from Oryx)

  • Dotnet
image
  • Python
image
  • Php
image
  • Nodejs
image

Sarath chandra Bussa added 4 commits April 1, 2026 13:14
Add two separate ACR SDK providers behind ORYX_ENABLE_ACR_SDK_PROVIDER:

1. ExternalAcrSdkProvider - communicates with LWASv2 via Unix socket
   to pull SDK images from WAWS Images ACR
2. AcrSdkProvider (direct) - downloads SDKs from Oryx ACR
   (oryxsdks.azurecr.io) using OCI Distribution API

New files:
- IExternalAcrSdkProvider.cs / ExternalAcrSdkProvider.cs
- OciRegistryClient.cs - HTTP client for OCI Distribution API
- AcrVersionProviderBase.cs - base class for ACR version discovery
- Per-platform ACR version providers (Node, Python, PHP, DotNetCore)
- publishSdkImageToAcr.sh / publishSdkToAcr.yml - ACR publish pipeline

Modified files:
- Platform install decisions (NodePlatform, PythonPlatform, PhpPlatform,
  DotNetCorePlatform) with ACR branch before existing DynamicInstall
- Version provider orchestrators with ACR provider chain
- PlatformInstallerBase with GetAcrInstallerScriptSnippet()
- Go startup script generator with ACR download path
- DI registrations for all new providers
- Constants, options, settings keys for ACR configuration

All changes are additive and behind feature flags.
Existing blob storage code paths are completely untouched.
…esolution

Remove ACR repository/tag construction from ExternalAcrSdkProvider.
Now sends only platform, version, and debianFlavor to LWASv2.
LWASv2 resolves the SDK companion image from LinuxAssets and
handles pinning, containerd pull, mount, and extraction.
… OneBranch pipeline)

Remove publishSdkImageToAcr.sh and publishSdkToAcr.yml since SDK images
are now built and pushed using onebranch.pipeline.imagebuildinfo in
the AAPT-Antares-Oryx pipeline, not via custom scripts.
@CodingIsBliss CodingIsBliss changed the title Oryx SDK regional distribution — pull SDKs from ACR feat: ACR-based SDK distribution with feature flag Apr 1, 2026
Use the same ACR that AAPT-Antares-Oryx publishes SDK images to.
Updated both C# constant and Go constant.
@CodingIsBliss CodingIsBliss force-pushed the feature/oryx-sdk-acr-distribution branch from 259f0c4 to faa6b2d Compare April 1, 2026 13:09
Sarath chandra Bussa added 2 commits April 1, 2026 19:22
- SA1204: Move static GetFirstLayerDigest before instance members (OciRegistryClient.cs)
- SA1124: Remove #region/#endregion around OCI JSON models (OciRegistryClient.cs)
- SA1202: Move protected GetAcrInstallerScriptSnippet before private methods (PlatformInstallerBase.cs)
- SA1116/SA1117: Place multi-line parameters each on own line (ExternalAcrSdkProvider.cs)
- SA1515: Add blank line before single-line comment (DotNetCoreAcrVersionProvider.cs)
- SA1204: Move static GetFirstLayerDigest before instance members (OciRegistryClient.cs)
- SA1124: Remove #region/#endregion around OCI JSON models (OciRegistryClient.cs)
- SA1202: Move protected GetAcrInstallerScriptSnippet before private methods (PlatformInstallerBase.cs)
- SA1116/SA1117: Place multi-line parameters each on own line (ExternalAcrSdkProvider.cs)
- SA1515: Add blank line before single-line comment (DotNetCoreAcrVersionProvider.cs)
@CodingIsBliss CodingIsBliss force-pushed the feature/oryx-sdk-acr-distribution branch from 505580f to 3a88dfe Compare April 1, 2026 14:19
kumaraksh1 and others added 9 commits April 1, 2026 20:41
* fix: Resolve StyleCop analyzer errors in ACR SDK provider files

- SA1204: Move static GetFirstLayerDigest before instance members (OciRegistryClient.cs)
- SA1124: Remove #region/#endregion around OCI JSON models (OciRegistryClient.cs)
- SA1202: Move protected GetAcrInstallerScriptSnippet before private methods (PlatformInstallerBase.cs)
- SA1116/SA1117: Place multi-line parameters each on own line (ExternalAcrSdkProvider.cs)
- SA1515: Add blank line before single-line comment (DotNetCoreAcrVersionProvider.cs)

* fix sdk providers logic

* refactor pythonPlatform

* refctor for dotnet,php and node

---------

Co-authored-by: Sarath chandra Bussa <sbussa@microsoft.com>
@sarsharma
Copy link
Copy Markdown
Member

sarsharma commented Apr 2, 2026

Maybe we need 2 config flags here?
ORYX_ENABLE_EXTERNAL_ACR_SDK_PROVIDER
ORYX_ENABLE_ACR_SDK_PROVIDER

@kumaraksh1 kumaraksh1 changed the title feat: ACR-based SDK distribution with feature flag ACR-based SDK distribution Apr 6, 2026
sarsharma and others added 3 commits April 7, 2026 00:28
* add fallback for no versions returned

* improve image caching logic

* handle mcr repo
* nit fixes in pr review

* nit fixes 2.0

* refactor
@surenderssm
Copy link
Copy Markdown
Member

Can we list the scenarios which were used to test these changes?

Copy link
Copy Markdown
Collaborator

@siriande siriande left a comment

Choose a reason for hiding this comment

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

The Try...FromExternalSdkProvider and Try...FromExternalAcrSdkProvider methods look essentially identical across node, .NET and PHP (just swapping platform name strings and installer references etc.). Can we have a shared helper?

sarsharma and others added 7 commits April 7, 2026 21:59
* Fix composer logic

* nit
Add DOTNET_SDK_80, DOTNET_SDK_90, DOTNET_SDK_100 variables to pair with
existing runtime version variables. Add composerVersion for PHP Composer.
These are consumed by the Official and Buddy pipelines for SDK ACR publishing.
* fix node logic and some other bugs

* more fixes

* socket helper refactor

* more fixes

* add tests

* refactor version provider

* fix build

* bump version
* fix node logic and some other bugs

* more fixes

* socket helper refactor

* more fixes

* add tests

* refactor version provider

* fix build

* bump version

* add tests
@sarsharma
Copy link
Copy Markdown
Member

Just adding this comment here to update description with testing details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants