From eb3725f2fb1b5100648f7e66d4699cfb8dd65c9c Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Tue, 23 Jun 2026 17:09:36 -0700 Subject: [PATCH 01/35] refactor --- .pipelines/foundry-local-packaging.yml | 269 ------------------ .pipelines/v1/foundry-local-packaging.yml | 130 +++++++++ .pipelines/v1/templates/build-core-steps.yml | 1 + .pipelines/v1/templates/build-cs-steps.yml | 1 + .../v1/templates/build-js-addon-steps.yml | 1 + .pipelines/v1/templates/build-js-steps.yml | 1 + .../v1/templates/build-python-steps.yml | 1 + .pipelines/v1/templates/build-rust-steps.yml | 1 + .../{ => v1}/templates/checkout-steps.yml | 1 + .../v1/templates/package-core-steps.yml | 1 + .pipelines/v1/templates/stages-sdk-v1.yml | 86 +++--- .pipelines/v1/templates/test-cs-steps.yml | 1 + .pipelines/v1/templates/test-js-steps.yml | 1 + .pipelines/v1/templates/test-python-steps.yml | 1 + .pipelines/v1/templates/test-rust-steps.yml | 1 + .../templates/update-deps-versions-steps.yml | 1 + .pipelines/v2/foundry-local-packaging.yml | 115 ++++++++ .../v2/templates/stages-build-native.yml | 1 + .pipelines/v2/templates/stages-cs.yml | 21 +- .pipelines/v2/templates/stages-js.yml | 16 +- .pipelines/v2/templates/stages-python.yml | 21 +- .pipelines/v2/templates/stages-sdk-v2.yml | 1 + .pipelines/v2/templates/steps-build-cs.yml | 1 + .pipelines/v2/templates/steps-build-js.yml | 1 + .pipelines/v2/templates/steps-build-linux.yml | 8 +- .pipelines/v2/templates/steps-build-macos.yml | 8 +- .../v2/templates/steps-build-python.yml | 1 + .../v2/templates/steps-build-windows.yml | 8 +- .pipelines/v2/templates/steps-pack-js.yml | 1 + .pipelines/v2/templates/steps-pack-nuget.yml | 1 + .../v2/templates/steps-prefetch-nuget.yml | 1 + .pipelines/v2/templates/steps-test-cs.yml | 1 + .pipelines/v2/templates/steps-test-js.yml | 1 + .pipelines/v2/templates/steps-test-python.yml | 1 + 34 files changed, 349 insertions(+), 357 deletions(-) delete mode 100644 .pipelines/foundry-local-packaging.yml create mode 100644 .pipelines/v1/foundry-local-packaging.yml rename .pipelines/{ => v1}/templates/checkout-steps.yml (99%) create mode 100644 .pipelines/v2/foundry-local-packaging.yml diff --git a/.pipelines/foundry-local-packaging.yml b/.pipelines/foundry-local-packaging.yml deleted file mode 100644 index bedd8a3d1..000000000 --- a/.pipelines/foundry-local-packaging.yml +++ /dev/null @@ -1,269 +0,0 @@ -# Foundry Local Packaging Pipeline -# -# Builds Foundry Local Core from neutron-server (windows.ai.toolkit project), -# then packages the C# and JS SDKs from this repo using the built Core. -# -# Produces artifacts: flc-nuget, flc-nuget-winml, flc-wheels, flc-wheels-winml, -# cs-sdk, cs-sdk-winml, js-sdk, js-sdk-winml, python-sdk, python-sdk-winml, -# rust-sdk, rust-sdk-winml - -# CI: only auto-run on pushes to main / release branches. Without an explicit -# trigger block, ADO defaults to "every commit on every branch", which fires -# this expensive pipeline on every dev branch push. -# -# TODO: This prevents auto-run on all pushes but doesn't trigger commits to `main` and `release` -# branches. Re-enable when triggering is fixed. -# trigger: -# branches: -# include: -# - main -# - releases/* - -pr: -- main -- releases/* - -name: $(Date:yyyyMMdd).$(Rev:r) - -parameters: -- name: version - displayName: 'Package version (sdk_v2/...)' - type: string - default: '2.0.0' -- name: versionV1 - displayName: 'Package version (sdk/...)' - type: string - default: '1.3.0' -- name: prereleaseId - displayName: 'Pre-release identifier (e.g. rc1, beta).' - type: string - default: 'none' -- name: isRelease - displayName: 'Release build' - type: boolean - default: false -- name: buildV1 - displayName: 'Force build v1 sdk. If unchecked, auto-detected from PR changes.' - type: boolean - default: false -- name: neutronServerBranch - displayName: 'Foundry Local Core branch (windows.ai.toolkit/neutron-server)' - type: string - default: 'dev/FoundryLocalCore/main' - -variables: -- group: FoundryLocal-ESRP-Signing -# C++ SDK (sdk_v2/cpp) native dependency versions. Must match cmake defaults -# in sdk_v2/deps_versions.json. -- name: cppOrtVersion - value: '1.26.0' -- name: cppGenaiVersion - value: '0.14.1' -- name: cppWinmlVersion - value: '2.1.70' -- name: cppBuildConfig - value: 'RelWithDebInfo' - -resources: - repositories: - - repository: 1ESPipelineTemplates - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release - -extends: - template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates - parameters: - settings: - networkIsolationPolicy: Permissive - pool: - # default all windows jobs, individual jobs override - name: onnxruntime-Win-CPU-2022 - os: windows - sdl: - binskim: - break: false - scanOutputDirectoryOnly: true - stages: - # ── Detect Changed Paths ── - # Decides whether the legacy sdk/ branch should run. sdk_v2 always builds, - # so there is no buildV2 flag here. Emits one output variable on the - # `setflags` job: `buildV1` ("true"/"false"). - # - # Rules: - # * `buildV1` parameter set true => buildV1 = true. - # * Otherwise => buildV1 = true iff this branch has changes under sdk/ - # relative to its base. Base is the PR target branch when available, - # else origin/main. If that range is empty (e.g. post-merge CI build - # of main itself), fall back to the latest commit's diff so a merge - # that touched sdk/ still triggers v1. Branches forked off something - # other than main and built outside a PR will over-trigger; that's - # acceptable — release branches aren't expected to touch sdk/. - - stage: detect_changes - displayName: 'Detect Changed Paths' - dependsOn: [] - jobs: - - job: setflags - displayName: 'Compute build flags' - pool: - name: onnxruntime-Win-CPU-2022 - os: windows - steps: - - checkout: self - fetchDepth: 0 - - task: PowerShell@2 - name: setflags - displayName: 'Detect changed paths and set buildV1' - inputs: - targetType: inline - pwsh: true - script: | - $forceV1 = "${{ parameters.buildV1 }}" -eq "True" - - if ($forceV1) { - $buildV1 = $true - Write-Host "Manual override: buildV1=$buildV1" - } else { - # Read via env var so PowerShell doesn't mis-parse the literal - # '$(System.PullRequest.TargetBranch)' as a subexpression when - # ADO leaves it unresolved on non-PR runs. Env var is empty - # (not undefined) when the variable isn't set. - $prTarget = $env:SYSTEM_PULLREQUEST_TARGETBRANCH - if (-not [string]::IsNullOrEmpty($prTarget)) { - # Typically "refs/heads/"; normalize to a short name for git fetch + origin/ refs. - $baseBranch = $prTarget -replace '^refs/heads/', '' - Write-Host "Base branch (from PR target): $baseBranch" - } else { - $baseBranch = "main" - Write-Host "Base branch (fallback): $baseBranch" - } - - git fetch --no-tags --depth=50 origin $baseBranch 2>&1 | Out-Null - $diffRange = "origin/$baseBranch...HEAD" - $changed = @(git diff --name-only $diffRange) - Write-Host "Changed files vs $diffRange ($($changed.Count)):" - $changed | ForEach-Object { Write-Host " $_" } - - # On a build of the base branch itself (e.g. post-merge CI on main), - # the range above is empty. Fall back to the latest commit's diff so - # a merge that touched sdk/ still triggers v1. - if ($changed.Count -eq 0) { - $diffRange = "HEAD~1...HEAD" - $changed = @(git diff --name-only $diffRange) - Write-Host "Empty range vs base; falling back to $diffRange ($($changed.Count)):" - $changed | ForEach-Object { Write-Host " $_" } - } - - $buildV1 = @($changed | Where-Object { $_ -like 'sdk/*' }).Count -gt 0 - Write-Host "Auto-detected: buildV1=$buildV1" - } - - $v1 = $buildV1.ToString().ToLower() - Write-Host "##vso[task.setvariable variable=buildV1;isOutput=true]$v1" - - # ── Compute Version ── - # A single version string is computed once and shared across all stages. - # This prevents timestamp drift between standard and WinML builds. - # Outputs (written to the `version-info` pipeline artifact): - # sdk_v2 (no suffix; FLC is legacy-only and not emitted here): - # sdkVersion.txt – semver for C# (e.g. X.Y.Z-dev.202604061234) - # pyVersion.txt – PEP 440 for Python (e.g. X.Y.Z.dev202604061234) - # Legacy sdk/ (.v1. suffix): - # sdkVersion.v1.txt – semver for JS, C#, Rust - # pyVersion.v1.txt – PEP 440 for Python - # flcVersion.v1.txt – NuGet/FLC style - - stage: compute_version - displayName: 'Compute Version' - dependsOn: [] - jobs: - - job: version - displayName: 'Compute Version' - pool: - name: onnxruntime-Win-CPU-2022 - os: windows - templateContext: - outputs: - - output: pipelineArtifact - artifactName: 'version-info' - targetPath: '$(Build.ArtifactStagingDirectory)/version-info' - steps: - - checkout: none - - task: PowerShell@2 - displayName: 'Compute and write version files' - inputs: - targetType: inline - script: | - $preId = "${{ parameters.prereleaseId }}" - $ts = Get-Date -Format "yyyyMMddHHmm" - $commitId = "$(Build.SourceVersion)".Substring(0, 8) - - function Compute-Versions([string]$base, [bool]$includeFlc) { - if ($preId -ne '' -and $preId -ne 'none') { - $result = @{ - sdk = "$base-$preId" - py = "$base$preId" - } - if ($includeFlc) { $result.flc = "$base-$preId" } - return $result - } elseif ("${{ parameters.isRelease }}" -ne "True") { - $result = @{ - sdk = "$base-dev.$ts" - py = "$base.dev$ts" - } - if ($includeFlc) { $result.flc = "$base-dev-$ts-$commitId" } - return $result - } else { - $result = @{ - sdk = $base - py = $base - } - if ($includeFlc) { $result.flc = $base } - return $result - } - } - - $v2 = Compute-Versions "${{ parameters.version }}" $false - $v1 = Compute-Versions "${{ parameters.versionV1 }}" $true - - $outDir = "$(Build.ArtifactStagingDirectory)/version-info" - New-Item -ItemType Directory -Path $outDir -Force | Out-Null - - # sdk_v2 versions (canonical, no suffix). No flcVersion — v2 - # does not consume Foundry Local Core. - Set-Content -Path "$outDir/sdkVersion.txt" -Value $v2.sdk -NoNewline - Set-Content -Path "$outDir/pyVersion.txt" -Value $v2.py -NoNewline - - # Legacy sdk/ versions (.v1. suffix). - Set-Content -Path "$outDir/sdkVersion.v1.txt" -Value $v1.sdk -NoNewline - Set-Content -Path "$outDir/pyVersion.v1.txt" -Value $v1.py -NoNewline - Set-Content -Path "$outDir/flcVersion.v1.txt" -Value $v1.flc -NoNewline - - Write-Host "v2 SDK version: $($v2.sdk)" - Write-Host "v2 Python version: $($v2.py)" - Write-Host "v1 SDK version: $($v1.sdk)" - Write-Host "v1 Python version: $($v1.py)" - Write-Host "v1 FLC version: $($v1.flc)" - - # -- sdk_v1 (sdk/) C++ Core (FLC) + C# / JS / Python / Rust SDKs -- - # Entire subgraph is gated by a single artificial root stage (`v1_gate`) - # defined inside stages-sdk-v1.yml. When detect_changes.buildV1 is false, - # v1_gate is skipped and every downstream v1 stage skips via the default - # `succeeded()` cascade. - - template: v1/templates/stages-sdk-v1.yml - parameters: - gateCondition: eq(dependencies.detect_changes.outputs['setflags.setflags.buildV1'], 'true') - gateDependsOn: [detect_changes] - version: ${{ parameters.versionV1 }} - prereleaseId: ${{ parameters.prereleaseId }} - isRelease: ${{ parameters.isRelease }} - neutronServerBranch: ${{ parameters.neutronServerBranch }} - - - # ── sdk_v2 (C++ native + C# SDK + Python SDK) ── - # Built unconditionally on every run; no detect_changes gate. - - template: v2/templates/stages-sdk-v2.yml - parameters: - buildConfig: $(cppBuildConfig) - ortVersion: $(cppOrtVersion) - genaiVersion: $(cppGenaiVersion) - winmlVersion: $(cppWinmlVersion) diff --git a/.pipelines/v1/foundry-local-packaging.yml b/.pipelines/v1/foundry-local-packaging.yml new file mode 100644 index 000000000..7c02f23f5 --- /dev/null +++ b/.pipelines/v1/foundry-local-packaging.yml @@ -0,0 +1,130 @@ +# Foundry Local Packaging Pipeline (v1) +# +# Builds Foundry Local Core from neutron-server (windows.ai.toolkit project), +# then packages the C# and JS SDKs from this repo using the built Core. +# +# Produces artifacts: flc-nuget, flc-nuget-winml, flc-wheels, flc-wheels-winml, +# cs-sdk, cs-sdk-winml, js-sdk, js-sdk-winml, python-sdk, python-sdk-winml, +# rust-sdk, rust-sdk-winml + +# CI: only auto-run on pushes to main / release branches. Without an explicit +# trigger block, ADO defaults to "every commit on every branch", which fires +# this expensive pipeline on every dev branch push. +# +# TODO: This prevents auto-run on all pushes but doesn't trigger commits to `main` and `release` +# branches. Re-enable when triggering is fixed. +# trigger: +# branches: +# include: +# - main +# - releases/* + +pr: +- main +- releases/* + +name: $(Date:yyyyMMdd).$(Rev:r) + +parameters: +- name: versionV1 + displayName: 'Package version (sdk/...)' + type: string + default: '1.3.0' +- name: prereleaseId + displayName: 'Pre-release identifier (e.g. rc1, beta).' + type: string + default: 'none' +- name: isRelease + displayName: 'Release build' + type: boolean + default: false +- name: neutronServerBranch + displayName: 'Foundry Local Core branch (windows.ai.toolkit/neutron-server)' + type: string + default: 'dev/FoundryLocalCore/main' + +variables: +- group: FoundryLocal-ESRP-Signing + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + settings: + networkIsolationPolicy: Permissive + pool: + # default all windows jobs, individual jobs override + name: onnxruntime-Win-CPU-2022 + os: windows + sdl: + binskim: + break: false + scanOutputDirectoryOnly: true + stages: + # ── Compute Version ── + # Computes the legacy sdk/ version files consumed by stages-sdk-v1.yml. + - stage: compute_version + displayName: 'Compute Version' + dependsOn: [] + jobs: + - job: version + displayName: 'Compute Version' + pool: + name: onnxruntime-Win-CPU-2022 + os: windows + templateContext: + outputs: + - output: pipelineArtifact + artifactName: 'version-info' + targetPath: '$(Build.ArtifactStagingDirectory)/version-info' + steps: + - checkout: none + - task: PowerShell@2 + displayName: 'Compute and write version files' + inputs: + targetType: inline + script: | + $preId = "${{ parameters.prereleaseId }}" + $ts = Get-Date -Format "yyyyMMddHHmm" + $commitId = "$(Build.SourceVersion)".Substring(0, 8) + + if ($preId -ne '' -and $preId -ne 'none') { + $sdkVersion = "${{ parameters.versionV1 }}-$preId" + $pyVersion = "${{ parameters.versionV1 }}$preId" + $flcVersion = "${{ parameters.versionV1 }}-$preId" + } elseif ("${{ parameters.isRelease }}" -ne "True") { + $sdkVersion = "${{ parameters.versionV1 }}-dev.$ts" + $pyVersion = "${{ parameters.versionV1 }}.dev$ts" + $flcVersion = "${{ parameters.versionV1 }}-dev-$ts-$commitId" + } else { + $sdkVersion = "${{ parameters.versionV1 }}" + $pyVersion = "${{ parameters.versionV1 }}" + $flcVersion = "${{ parameters.versionV1 }}" + } + + $outDir = "$(Build.ArtifactStagingDirectory)/version-info" + New-Item -ItemType Directory -Path $outDir -Force | Out-Null + + Set-Content -Path "$outDir/sdkVersion.v1.txt" -Value $sdkVersion -NoNewline + Set-Content -Path "$outDir/pyVersion.v1.txt" -Value $pyVersion -NoNewline + Set-Content -Path "$outDir/flcVersion.v1.txt" -Value $flcVersion -NoNewline + + Write-Host "v1 SDK version: $sdkVersion" + Write-Host "v1 Python version: $pyVersion" + Write-Host "v1 FLC version: $flcVersion" + + # -- sdk_v1 (sdk/) C++ Core (FLC) + C# / JS / Python / Rust SDKs -- + # Entire subgraph is rooted at the artificial `v1_gate` stage defined + # inside stages-sdk-v1.yml. + - template: templates/stages-sdk-v1.yml + parameters: + version: ${{ parameters.versionV1 }} + prereleaseId: ${{ parameters.prereleaseId }} + isRelease: ${{ parameters.isRelease }} + neutronServerBranch: ${{ parameters.neutronServerBranch }} diff --git a/.pipelines/v1/templates/build-core-steps.yml b/.pipelines/v1/templates/build-core-steps.yml index e2f13aed3..41f70c66c 100644 --- a/.pipelines/v1/templates/build-core-steps.yml +++ b/.pipelines/v1/templates/build-core-steps.yml @@ -175,3 +175,4 @@ steps: Copy-Item -Destination $destDir -Force Write-Host "Staged binaries:" Get-ChildItem $destDir | ForEach-Object { Write-Host " $($_.Name)" } + diff --git a/.pipelines/v1/templates/build-cs-steps.yml b/.pipelines/v1/templates/build-cs-steps.yml index b9bfd962a..e9e6ca773 100644 --- a/.pipelines/v1/templates/build-cs-steps.yml +++ b/.pipelines/v1/templates/build-cs-steps.yml @@ -197,3 +197,4 @@ steps: inlineOperation: | [{"keyCode":"CP-401405","operationSetCode":"NuGetSign","parameters":[],"toolName":"sign","toolVersion":"6.2.9304.0"},{"keyCode":"CP-401405","operationSetCode":"NuGetVerify","parameters":[],"toolName":"sign","toolVersion":"6.2.9304.0"}] + diff --git a/.pipelines/v1/templates/build-js-addon-steps.yml b/.pipelines/v1/templates/build-js-addon-steps.yml index dce0f7fce..26eaac07b 100644 --- a/.pipelines/v1/templates/build-js-addon-steps.yml +++ b/.pipelines/v1/templates/build-js-addon-steps.yml @@ -43,3 +43,4 @@ steps: Copy-Item "build/Release/foundry_local_napi.node" "$destDir/foundry_local_napi.node" -Force Write-Host "Built addon for $platformKey -> $destDir/foundry_local_napi.node" Get-Item "$destDir/foundry_local_napi.node" | ForEach-Object { Write-Host " Size: $($_.Length) bytes" } + diff --git a/.pipelines/v1/templates/build-js-steps.yml b/.pipelines/v1/templates/build-js-steps.yml index 1b2a48263..521267bc7 100644 --- a/.pipelines/v1/templates/build-js-steps.yml +++ b/.pipelines/v1/templates/build-js-steps.yml @@ -219,3 +219,4 @@ steps: New-Item -ItemType Directory -Path $destDir -Force | Out-Null Copy-Item "$(repoRoot)/sdk/js/*.tgz" "$destDir/" + diff --git a/.pipelines/v1/templates/build-python-steps.yml b/.pipelines/v1/templates/build-python-steps.yml index 6309782cc..b8e36bf98 100644 --- a/.pipelines/v1/templates/build-python-steps.yml +++ b/.pipelines/v1/templates/build-python-steps.yml @@ -225,3 +225,4 @@ steps: Write-Host "Staged wheels:" Get-ChildItem $destDir | ForEach-Object { Write-Host " $($_.Name)" } + diff --git a/.pipelines/v1/templates/build-rust-steps.yml b/.pipelines/v1/templates/build-rust-steps.yml index 8402b9aac..31add02dc 100644 --- a/.pipelines/v1/templates/build-rust-steps.yml +++ b/.pipelines/v1/templates/build-rust-steps.yml @@ -219,3 +219,4 @@ steps: Write-Host "Staged crates:" Get-ChildItem $destDir | ForEach-Object { Write-Host " $($_.Name)" } + diff --git a/.pipelines/templates/checkout-steps.yml b/.pipelines/v1/templates/checkout-steps.yml similarity index 99% rename from .pipelines/templates/checkout-steps.yml rename to .pipelines/v1/templates/checkout-steps.yml index 601eacf56..bcdfe96c5 100644 --- a/.pipelines/templates/checkout-steps.yml +++ b/.pipelines/v1/templates/checkout-steps.yml @@ -72,3 +72,4 @@ steps: Pop-Location Write-Host "Checked out ${{ parameters.repoName }} at $(git -C $repoDir rev-parse HEAD)" + diff --git a/.pipelines/v1/templates/package-core-steps.yml b/.pipelines/v1/templates/package-core-steps.yml index fb9edc514..5cd5d344d 100644 --- a/.pipelines/v1/templates/package-core-steps.yml +++ b/.pipelines/v1/templates/package-core-steps.yml @@ -343,3 +343,4 @@ steps: New-Item -ItemType Directory -Path $outDir -Force | Out-Null [System.IO.File]::WriteAllText("$outDir/$fileName", $json, [System.Text.UTF8Encoding]::new($false)) Write-Host "Wrote $fileName to $outDir" + diff --git a/.pipelines/v1/templates/stages-sdk-v1.yml b/.pipelines/v1/templates/stages-sdk-v1.yml index 7bbd1f368..919aa081e 100644 --- a/.pipelines/v1/templates/stages-sdk-v1.yml +++ b/.pipelines/v1/templates/stages-sdk-v1.yml @@ -67,11 +67,11 @@ stages: artifactName: 'flc-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/native' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-core-steps.yml @@ -90,11 +90,11 @@ stages: artifactName: 'flc-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/native' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-core-steps.yml @@ -113,11 +113,11 @@ stages: artifactName: 'flc-linux-x64' targetPath: '$(Build.ArtifactStagingDirectory)/native' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-core-steps.yml @@ -137,11 +137,11 @@ stages: artifactName: 'flc-linux-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/native' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-core-steps.yml @@ -162,11 +162,11 @@ stages: artifactName: 'flc-osx-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/native' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared # AcesShared macOS agents don't have git-lfs pre-installed @@ -204,7 +204,7 @@ stages: artifactName: 'deps-versions-standard' targetPath: '$(Build.ArtifactStagingDirectory)/deps-versions' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} @@ -291,7 +291,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk' steps: - checkout: self - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-cs-steps.yml @@ -462,7 +462,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/js-sdk' steps: - checkout: self - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared @@ -552,7 +552,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - checkout: self - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-python-steps.yml @@ -597,7 +597,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/rust-sdk' steps: - checkout: self - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-rust-steps.yml @@ -677,7 +677,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -703,7 +703,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -730,7 +730,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -761,7 +761,7 @@ stages: displayName: 'Install Git LFS' - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -794,7 +794,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-js-steps.yml @@ -819,7 +819,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -846,7 +846,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -877,7 +877,7 @@ stages: displayName: 'Install Git LFS' - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-js-steps.yml @@ -912,7 +912,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-python-steps.yml @@ -941,7 +941,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -972,7 +972,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -1007,7 +1007,7 @@ stages: displayName: 'Install Git LFS' - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-python-steps.yml @@ -1040,7 +1040,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-rust-steps.yml @@ -1065,7 +1065,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-rust-steps.yml @@ -1091,7 +1091,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-rust-steps.yml @@ -1121,7 +1121,7 @@ stages: displayName: 'Install Git LFS' - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-rust-steps.yml @@ -1148,11 +1148,11 @@ stages: artifactName: 'flc-winml-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/native' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-core-steps.yml @@ -1172,11 +1172,11 @@ stages: artifactName: 'flc-winml-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/native' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-core-steps.yml @@ -1209,7 +1209,7 @@ stages: artifactName: 'deps-versions-winml' targetPath: '$(Build.ArtifactStagingDirectory)/deps-versions' steps: - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: neutron-server ref: refs/heads/${{ parameters.neutronServerBranch }} @@ -1275,7 +1275,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk-winml' steps: - checkout: self - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-cs-steps.yml @@ -1318,7 +1318,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/js-sdk' steps: - checkout: self - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared @@ -1408,7 +1408,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk-winml' steps: - checkout: self - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: build-python-steps.yml @@ -1444,7 +1444,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared basePath: '$(Agent.BuildDirectory)' @@ -1477,7 +1477,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-js-steps.yml @@ -1512,7 +1512,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self + - template: checkout-steps.yml parameters: repoName: test-data-shared - template: test-python-steps.yml @@ -1520,4 +1520,4 @@ stages: isWinML: true flcWheelsDir: '$(Pipeline.Workspace)/flc-wheels-winml' sdkWheelsDir: '$(Pipeline.Workspace)/python-sdk-winml' - depsVersionsDir: '$(Pipeline.Workspace)/deps-versions-winml' \ No newline at end of file + depsVersionsDir: '$(Pipeline.Workspace)/deps-versions-winml' diff --git a/.pipelines/v1/templates/test-cs-steps.yml b/.pipelines/v1/templates/test-cs-steps.yml index 605b36cf2..2f9eb4028 100644 --- a/.pipelines/v1/templates/test-cs-steps.yml +++ b/.pipelines/v1/templates/test-cs-steps.yml @@ -147,3 +147,4 @@ steps: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } env: TF_BUILD: 'true' + diff --git a/.pipelines/v1/templates/test-js-steps.yml b/.pipelines/v1/templates/test-js-steps.yml index 2d007f70b..64dfbb012 100644 --- a/.pipelines/v1/templates/test-js-steps.yml +++ b/.pipelines/v1/templates/test-js-steps.yml @@ -154,3 +154,4 @@ steps: env: TF_BUILD: 'true' FOUNDRY_TEST_DATA_DIR: $(testDataDir) + diff --git a/.pipelines/v1/templates/test-python-steps.yml b/.pipelines/v1/templates/test-python-steps.yml index cf2643982..6e77c151b 100644 --- a/.pipelines/v1/templates/test-python-steps.yml +++ b/.pipelines/v1/templates/test-python-steps.yml @@ -178,3 +178,4 @@ steps: env: TF_BUILD: 'true' FOUNDRY_TEST_DATA_DIR: $(testDataDir) + diff --git a/.pipelines/v1/templates/test-rust-steps.yml b/.pipelines/v1/templates/test-rust-steps.yml index 4d382b1de..67c893a46 100644 --- a/.pipelines/v1/templates/test-rust-steps.yml +++ b/.pipelines/v1/templates/test-rust-steps.yml @@ -134,3 +134,4 @@ steps: env: TF_BUILD: 'true' FOUNDRY_TEST_DATA_DIR: $(testDataDir) + diff --git a/.pipelines/v1/templates/update-deps-versions-steps.yml b/.pipelines/v1/templates/update-deps-versions-steps.yml index 6f0ebcc34..fae88114a 100644 --- a/.pipelines/v1/templates/update-deps-versions-steps.yml +++ b/.pipelines/v1/templates/update-deps-versions-steps.yml @@ -42,3 +42,4 @@ steps: if ($isWinML -and $deps.'windows-ai-machinelearning') { Write-Host " Windows AI ML: $($deps.'windows-ai-machinelearning'.version)" } + diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml new file mode 100644 index 000000000..06457fab4 --- /dev/null +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -0,0 +1,115 @@ +# Foundry Local Packaging Pipeline (v2) +# +# Builds and packages sdk_v2 artifacts only: +# - Native runtime artifacts (base + WinML) +# - C# SDK (base + WinML) +# - Python SDK (base + WinML) +# - JS SDK + +pr: +- main +- releases/* + +name: $(Date:yyyyMMdd).$(Rev:r) + +parameters: +- name: version + displayName: 'Package version (sdk_v2/...)' + type: string + default: '2.0.0' +- name: prereleaseId + displayName: 'Pre-release identifier (e.g. rc1, beta).' + type: string + default: 'none' +- name: isRelease + displayName: 'Release build' + type: boolean + default: false + +variables: +- group: FoundryLocal-ESRP-Signing +# C++ SDK (sdk_v2/cpp) native dependency versions. Must match cmake defaults +# in sdk_v2/deps_versions.json. +- name: cppOrtVersion + value: '1.26.0' +- name: cppGenaiVersion + value: '0.14.1' +- name: cppWinmlVersion + value: '2.1.70' +- name: cppBuildConfig + value: 'RelWithDebInfo' + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + - repository: test-data-shared + type: git + name: windows.ai.toolkit/test-data-shared + ref: refs/heads/main + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + settings: + networkIsolationPolicy: Permissive + pool: + # default all windows jobs, individual jobs override + name: onnxruntime-Win-CPU-2022 + os: windows + sdl: + binskim: + break: false + scanOutputDirectoryOnly: true + stages: + - stage: compute_version + displayName: 'Compute Version' + dependsOn: [] + jobs: + - job: version + displayName: 'Compute Version' + pool: + name: onnxruntime-Win-CPU-2022 + os: windows + templateContext: + outputs: + - output: pipelineArtifact + artifactName: 'version-info' + targetPath: '$(Build.ArtifactStagingDirectory)/version-info' + steps: + - checkout: none + - task: PowerShell@2 + displayName: 'Compute and write version files' + inputs: + targetType: inline + script: | + $preId = "${{ parameters.prereleaseId }}" + $ts = Get-Date -Format "yyyyMMddHHmm" + + if ($preId -ne '' -and $preId -ne 'none') { + $sdkVersion = "${{ parameters.version }}-$preId" + $pyVersion = "${{ parameters.version }}$preId" + } elseif ("${{ parameters.isRelease }}" -ne "True") { + $sdkVersion = "${{ parameters.version }}-dev.$ts" + $pyVersion = "${{ parameters.version }}.dev$ts" + } else { + $sdkVersion = "${{ parameters.version }}" + $pyVersion = "${{ parameters.version }}" + } + + $outDir = "$(Build.ArtifactStagingDirectory)/version-info" + New-Item -ItemType Directory -Path $outDir -Force | Out-Null + Set-Content -Path "$outDir/sdkVersion.txt" -Value $sdkVersion -NoNewline + Set-Content -Path "$outDir/pyVersion.txt" -Value $pyVersion -NoNewline + + Write-Host "v2 SDK version: $sdkVersion" + Write-Host "v2 Python version: $pyVersion" + + - template: templates/stages-sdk-v2.yml + parameters: + buildConfig: $(cppBuildConfig) + ortVersion: $(cppOrtVersion) + genaiVersion: $(cppGenaiVersion) + winmlVersion: $(cppWinmlVersion) diff --git a/.pipelines/v2/templates/stages-build-native.yml b/.pipelines/v2/templates/stages-build-native.yml index 09a75c33e..a99fe846a 100644 --- a/.pipelines/v2/templates/stages-build-native.yml +++ b/.pipelines/v2/templates/stages-build-native.yml @@ -298,3 +298,4 @@ stages: ortVersion: ${{ parameters.ortVersion }} genaiVersion: ${{ parameters.genaiVersion }} variant: winml + diff --git a/.pipelines/v2/templates/stages-cs.yml b/.pipelines/v2/templates/stages-cs.yml index c271dda13..81e633167 100644 --- a/.pipelines/v2/templates/stages-cs.yml +++ b/.pipelines/v2/templates/stages-cs.yml @@ -129,9 +129,8 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' @@ -159,9 +158,8 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_winml.nativeArtifact }}' @@ -192,9 +190,8 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' @@ -230,12 +227,12 @@ stages: fi git lfs install displayName: 'Install git-lfs (macOS)' - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' isWinML: false testDataSharedDir: '$(Build.SourcesDirectory)/test-data-shared' additionalTestArgs: '--settings $(Build.SourcesDirectory)/sdk_v2/cs/test/FoundryLocal.Tests/sequential.runsettings' + diff --git a/.pipelines/v2/templates/stages-js.yml b/.pipelines/v2/templates/stages-js.yml index e434f7c74..c35af7e49 100644 --- a/.pipelines/v2/templates/stages-js.yml +++ b/.pipelines/v2/templates/stages-js.yml @@ -198,9 +198,8 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-js.yml parameters: rid: 'win-x64' @@ -224,9 +223,8 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-js.yml parameters: rid: 'linux-x64' @@ -259,9 +257,8 @@ stages: fi git lfs install displayName: 'Install git-lfs (macOS)' - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-js.yml parameters: rid: 'osx-arm64' @@ -311,3 +308,4 @@ stages: - template: steps-pack-js.yml parameters: outputDir: '$(Build.ArtifactStagingDirectory)/js-sdk-v2' + diff --git a/.pipelines/v2/templates/stages-python.yml b/.pipelines/v2/templates/stages-python.yml index 7a07c7dae..f43e1c0cb 100644 --- a/.pipelines/v2/templates/stages-python.yml +++ b/.pipelines/v2/templates/stages-python.yml @@ -178,9 +178,8 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-base-win-x64' @@ -204,9 +203,8 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-base-linux-x64' @@ -239,9 +237,8 @@ stages: fi git lfs install displayName: 'Install git-lfs (macOS)' - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-base-osx-arm64' @@ -336,11 +333,11 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared + lfs: true - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-winml-win-x64' testDataSharedDir: '$(Build.SourcesDirectory)/test-data-shared' isWinML: true + diff --git a/.pipelines/v2/templates/stages-sdk-v2.yml b/.pipelines/v2/templates/stages-sdk-v2.yml index 5a1c59bab..34794ea01 100644 --- a/.pipelines/v2/templates/stages-sdk-v2.yml +++ b/.pipelines/v2/templates/stages-sdk-v2.yml @@ -53,3 +53,4 @@ stages: # ── JS SDK (single multi-platform tarball) ── - template: stages-js.yml + diff --git a/.pipelines/v2/templates/steps-build-cs.yml b/.pipelines/v2/templates/steps-build-cs.yml index 1c77af191..d56088364 100644 --- a/.pipelines/v2/templates/steps-build-cs.yml +++ b/.pipelines/v2/templates/steps-build-cs.yml @@ -171,3 +171,4 @@ steps: signConfigType: inlineSignParams inlineOperation: | [{"keyCode":"CP-401405","operationSetCode":"NuGetSign","parameters":[],"toolName":"sign","toolVersion":"6.2.9304.0"},{"keyCode":"CP-401405","operationSetCode":"NuGetVerify","parameters":[],"toolName":"sign","toolVersion":"6.2.9304.0"}] + diff --git a/.pipelines/v2/templates/steps-build-js.yml b/.pipelines/v2/templates/steps-build-js.yml index 5e6ab1e77..c8a2de78e 100644 --- a/.pipelines/v2/templates/steps-build-js.yml +++ b/.pipelines/v2/templates/steps-build-js.yml @@ -220,3 +220,4 @@ steps: signConfigType: inlineSignParams inlineOperation: | [{"keyCode":"CP-401337","operationSetCode":"MacAppDeveloperSign","parameters":[{"parameterName":"hardening","parameterValue":"--options=runtime"}],"toolName":"sign","toolVersion":"1.0"}] + diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index b16b13fdd..ca6deef34 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -43,10 +43,9 @@ steps: displayName: 'Append version define' - ${{ if eq(parameters.runTests, true) }}: - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared - basePath: '$(Agent.BuildDirectory)' + - checkout: test-data-shared + lfs: true + path: test-data-shared - bash: | set -euo pipefail @@ -97,3 +96,4 @@ steps: cp -P "$primary" "$dst/" echo " staged libfoundry_local.so" displayName: 'Stage native artifacts' + diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index 278bdbff8..e338cc2f4 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -51,10 +51,9 @@ steps: displayName: 'Append version define' - ${{ if eq(parameters.runTests, true) }}: - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared - basePath: '$(Agent.BuildDirectory)' + - checkout: test-data-shared + lfs: true + path: test-data-shared - bash: | set -euo pipefail @@ -102,3 +101,4 @@ steps: cp -P "$primary" "$dst/" echo " staged libfoundry_local.dylib" displayName: 'Stage native artifacts' + diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index fe81d69cd..13cea2324 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -340,3 +340,4 @@ steps: script: | Get-ChildItem "${{ parameters.outputDir }}" -Filter '*.whl' | ForEach-Object { Write-Host ("{0,12} {1}" -f $_.Length, $_.Name) } + diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 0e17f07b6..5a3fed67e 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -78,10 +78,9 @@ steps: # Tests need shared model files. - ${{ if eq(parameters.runTests, true) }}: - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared - basePath: '$(Agent.BuildDirectory)' + - checkout: test-data-shared + lfs: true + path: test-data-shared - ${{ if and(eq(parameters.arch, 'x64'), eq(parameters.useWinml, false)) }}: - script: >- @@ -205,3 +204,4 @@ steps: SourceFolder: '$(Build.SourcesDirectory)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include/gsl' + diff --git a/.pipelines/v2/templates/steps-pack-js.yml b/.pipelines/v2/templates/steps-pack-js.yml index 439ab41fd..935fd753c 100644 --- a/.pipelines/v2/templates/steps-pack-js.yml +++ b/.pipelines/v2/templates/steps-pack-js.yml @@ -78,3 +78,4 @@ steps: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Get-ChildItem $dst | ForEach-Object { Write-Host " $($_.Name) $($_.Length) bytes" } displayName: 'npm pack' + diff --git a/.pipelines/v2/templates/steps-pack-nuget.yml b/.pipelines/v2/templates/steps-pack-nuget.yml index bde97d772..e61ad8e61 100644 --- a/.pipelines/v2/templates/steps-pack-nuget.yml +++ b/.pipelines/v2/templates/steps-pack-nuget.yml @@ -100,3 +100,4 @@ steps: Write-Host "Generated packages:" Get-ChildItem $outDir -Filter '*.nupkg' | ForEach-Object { Write-Host " $($_.Name)" } + diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 661075294..b6dda473a 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -167,3 +167,4 @@ steps: echo "##vso[task.setvariable variable=cmakeFetchDefines]$joined" echo "cmakeFetchDefines = $joined" displayName: 'Pre-download NuGet packages' + diff --git a/.pipelines/v2/templates/steps-test-cs.yml b/.pipelines/v2/templates/steps-test-cs.yml index 73274e275..0b2638fdf 100644 --- a/.pipelines/v2/templates/steps-test-cs.yml +++ b/.pipelines/v2/templates/steps-test-cs.yml @@ -185,3 +185,4 @@ steps: env: TF_BUILD: 'true' FOUNDRY_TEST_DATA_DIR: ${{ parameters.testDataSharedDir }} + diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index d161da06e..e88eef1ee 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -88,3 +88,4 @@ steps: displayName: 'Run vitest' env: FOUNDRY_TEST_DATA_DIR: '${{ parameters.testDataSharedDir }}' + diff --git a/.pipelines/v2/templates/steps-test-python.yml b/.pipelines/v2/templates/steps-test-python.yml index 9396a7cce..cb46fab01 100644 --- a/.pipelines/v2/templates/steps-test-python.yml +++ b/.pipelines/v2/templates/steps-test-python.yml @@ -95,3 +95,4 @@ steps: env: TF_BUILD: 'true' FOUNDRY_TEST_DATA_DIR: ${{ parameters.testDataSharedDir }} + From 22a66f9d6a3503be781065cf3da09c3382f03b08 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Tue, 23 Jun 2026 17:13:30 -0700 Subject: [PATCH 02/35] windows.ai.toolkit --- .pipelines/v2/foundry-local-packaging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index 06457fab4..ec9f27e55 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -47,7 +47,7 @@ resources: ref: refs/tags/release - repository: test-data-shared type: git - name: windows.ai.toolkit/test-data-shared + name: AIFoundryLocal/test-data-shared ref: refs/heads/main extends: From 6ff32d9b31ee815fa477229401e8f0f94733781b Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Tue, 23 Jun 2026 17:17:31 -0700 Subject: [PATCH 03/35] sdl --- .pipelines/v2/foundry-local-packaging.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index ec9f27e55..00fd2e44f 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -60,6 +60,9 @@ extends: name: onnxruntime-Win-CPU-2022 os: windows sdl: + sourceRepositoriesToScan: + exclude: + - repository: test-data-shared binskim: break: false scanOutputDirectoryOnly: true From 0b356a5d76d4f58644b54bcb3a022a1ee22467bc Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Tue, 23 Jun 2026 17:48:57 -0700 Subject: [PATCH 04/35] ref --- .pipelines/v1/templates/stages-sdk-v1.yml | 54 ++----------------- .pipelines/v2/templates/stages-cs.yml | 3 +- .pipelines/v2/templates/steps-build-cs.yml | 9 ++-- .pipelines/v2/templates/steps-build-js.yml | 15 +++--- .pipelines/v2/templates/steps-build-linux.yml | 7 +-- .pipelines/v2/templates/steps-build-macos.yml | 7 +-- .../v2/templates/steps-build-python.yml | 9 ++-- .../v2/templates/steps-build-windows.yml | 19 +++---- .pipelines/v2/templates/steps-pack-js.yml | 11 ++-- .pipelines/v2/templates/steps-pack-nuget.yml | 5 +- .../v2/templates/steps-prefetch-nuget.yml | 5 +- .pipelines/v2/templates/steps-test-cs.yml | 7 +-- .pipelines/v2/templates/steps-test-js.yml | 17 +++--- .pipelines/v2/templates/steps-test-python.yml | 3 +- 14 files changed, 70 insertions(+), 101 deletions(-) diff --git a/.pipelines/v1/templates/stages-sdk-v1.yml b/.pipelines/v1/templates/stages-sdk-v1.yml index 919aa081e..b965b7d6a 100644 --- a/.pipelines/v1/templates/stages-sdk-v1.yml +++ b/.pipelines/v1/templates/stages-sdk-v1.yml @@ -3,16 +3,9 @@ # Produces NuGet/wheel/JS artifacts for Foundry Local Core (FLC) plus the # v1 C# / JS / Python / Rust SDKs in both base and WinML flavors. # -# Assumes the caller has already emitted: -# * a `compute_version` stage publishing the `version-info` pipeline -# artifact (containing sdkVersion.v1.txt, pyVersion.v1.txt, flcVersion.v1.txt) -# * any stage referenced by `gateDependsOn` (typically `detect_changes`) -# -# The entire subgraph is gated by a single artificial root stage (`v1_gate`) -# whose runtime condition is supplied via `gateCondition`. When v1_gate is -# skipped, every downstream v1 stage skips via ADO's default `succeeded()` -# cascade on dependsOn. See stages-sdk-v2.yml for the rationale behind this -# pattern. +# Assumes the caller has already emitted a `compute_version` stage +# publishing the `version-info` pipeline artifact +# (sdkVersion.v1.txt, pyVersion.v1.txt, flcVersion.v1.txt). parameters: - name: version @@ -25,35 +18,12 @@ parameters: default: false - name: neutronServerBranch type: string -- name: gateCondition - type: string - default: 'succeeded()' -- name: gateDependsOn - type: object - default: [] stages: -# -- Artificial root: gates the entire v1 subgraph -- -- stage: v1_gate - displayName: 'sdk_v1 build gate' - condition: ${{ parameters.gateCondition }} - dependsOn: ${{ parameters.gateDependsOn }} - jobs: - - job: noop - displayName: 'sdk_v1 build enabled' - pool: - name: onnxruntime-Win-CPU-2022 - os: windows - steps: - - checkout: none - - script: echo "sdk_v1 build enabled" - displayName: 'sdk_v1 build enabled' - - stage: build_core displayName: 'Build Core' dependsOn: - - v1_gate - compute_version jobs: - job: flc_win_x64 @@ -266,7 +236,6 @@ stages: - stage: build_cs displayName: 'Build C# SDK' dependsOn: - - v1_gate - build_core jobs: - job: cs_sdk @@ -306,7 +275,7 @@ stages: # ── Build JS Node-API Addon (all platforms) ── - stage: build_js_addon displayName: 'Build JS Addon' - dependsOn: [v1_gate] + dependsOn: [] jobs: - job: js_addon_win_x64 displayName: 'Addon win32-x64' @@ -436,7 +405,6 @@ stages: - stage: build_js displayName: 'Build JS SDK' dependsOn: - - v1_gate - build_core - build_js_addon jobs: @@ -527,7 +495,6 @@ stages: - stage: build_python displayName: 'Build Python SDK' dependsOn: - - v1_gate - build_core jobs: - job: python_sdk @@ -568,7 +535,6 @@ stages: - stage: build_rust displayName: 'Build Rust SDK' dependsOn: - - v1_gate - build_core - build_core_winml jobs: @@ -658,7 +624,6 @@ stages: - stage: test_cs displayName: 'Test C#' dependsOn: - - v1_gate - build_cs jobs: - job: test_cs_win_x64 @@ -775,7 +740,6 @@ stages: - stage: test_js displayName: 'Test JS' dependsOn: - - v1_gate - build_js jobs: - job: test_js_win_x64 @@ -890,7 +854,6 @@ stages: - stage: test_python displayName: 'Test Python' dependsOn: - - v1_gate - build_python jobs: - job: test_python_win_x64 @@ -1021,7 +984,6 @@ stages: - stage: test_rust displayName: 'Test Rust' dependsOn: - - v1_gate - build_rust jobs: - job: test_rust_win_x64 @@ -1134,7 +1096,6 @@ stages: - stage: build_core_winml displayName: 'Build Core (WinML)' dependsOn: - - v1_gate - compute_version jobs: - job: flc_winml_win_x64 @@ -1250,7 +1211,6 @@ stages: - stage: build_cs_winml displayName: 'Build C# SDK (WinML)' dependsOn: - - v1_gate - build_core_winml jobs: - job: cs_sdk_winml @@ -1292,7 +1252,6 @@ stages: - stage: build_js_winml displayName: 'Build JS SDK (WinML)' dependsOn: - - v1_gate - build_core_winml - build_js_addon jobs: @@ -1383,7 +1342,6 @@ stages: - stage: build_python_winml displayName: 'Build Python SDK (WinML)' dependsOn: - - v1_gate - build_core_winml jobs: - job: python_sdk_winml @@ -1425,7 +1383,6 @@ stages: - stage: test_cs_winml displayName: 'Test C# (WinML)' dependsOn: - - v1_gate - build_cs_winml jobs: - job: test_cs_winml_win_x64 @@ -1458,7 +1415,6 @@ stages: - stage: test_js_winml displayName: 'Test JS (WinML)' dependsOn: - - v1_gate - build_js_winml jobs: - job: test_js_winml_win_x64 @@ -1490,7 +1446,6 @@ stages: - stage: test_python_winml displayName: 'Test Python (WinML)' dependsOn: - - v1_gate - build_python_winml jobs: - job: test_python_winml_win_x64 @@ -1521,3 +1476,4 @@ stages: flcWheelsDir: '$(Pipeline.Workspace)/flc-wheels-winml' sdkWheelsDir: '$(Pipeline.Workspace)/python-sdk-winml' depsVersionsDir: '$(Pipeline.Workspace)/deps-versions-winml' + diff --git a/.pipelines/v2/templates/stages-cs.yml b/.pipelines/v2/templates/stages-cs.yml index 81e633167..a791d7d5e 100644 --- a/.pipelines/v2/templates/stages-cs.yml +++ b/.pipelines/v2/templates/stages-cs.yml @@ -234,5 +234,6 @@ stages: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' isWinML: false testDataSharedDir: '$(Build.SourcesDirectory)/test-data-shared' - additionalTestArgs: '--settings $(Build.SourcesDirectory)/sdk_v2/cs/test/FoundryLocal.Tests/sequential.runsettings' + additionalTestArgs: '--settings $(Build.Repository.LocalPath)/sdk_v2/cs/test/FoundryLocal.Tests/sequential.runsettings' + diff --git a/.pipelines/v2/templates/steps-build-cs.yml b/.pipelines/v2/templates/steps-build-cs.yml index d56088364..8626bae15 100644 --- a/.pipelines/v2/templates/steps-build-cs.yml +++ b/.pipelines/v2/templates/steps-build-cs.yml @@ -88,7 +88,7 @@ steps: targetType: inline pwsh: true script: | - $proj = "$(Build.SourcesDirectory)/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj" + $proj = "$(Build.Repository.LocalPath)/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj" if (-not (Test-Path $proj)) { throw "Project not found: $proj" } dotnet restore $proj ` --configfile "$(customNugetConfig)" ` @@ -103,7 +103,7 @@ steps: targetType: inline pwsh: true script: | - dotnet build "$(Build.SourcesDirectory)/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj" ` + dotnet build "$(Build.Repository.LocalPath)/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj" ` --no-restore --configuration Release ` /p:UseWinML=${{ parameters.isWinML }} ` /p:FoundryLocalRuntimeVersion=$(packageVersion) ` @@ -122,7 +122,7 @@ steps: EsrpClientId: '$(esrpClientId)' AuthAKVName: '$(esrpAkvName)' AuthSignCertName: '$(esrpSignCertName)' - FolderPath: '$(Build.SourcesDirectory)/sdk_v2/cs/src/bin/Release' + FolderPath: '$(Build.Repository.LocalPath)/sdk_v2/cs/src/bin/Release' # Pattern is passed to .NET Directory.EnumerateFiles with SearchOption.AllDirectories, # so it must be a plain filename (no '/' or '**'). Recursion across TFM subfolders is # provided by the task itself when UseMinimatch=false. @@ -141,7 +141,7 @@ steps: targetType: inline pwsh: true script: | - dotnet pack "$(Build.SourcesDirectory)/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj" ` + dotnet pack "$(Build.Repository.LocalPath)/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj" ` --no-build --no-restore --configuration Release ` --output "${{ parameters.outputDir }}" ` /p:PackageVersion=$(packageVersion) ` @@ -172,3 +172,4 @@ steps: inlineOperation: | [{"keyCode":"CP-401405","operationSetCode":"NuGetSign","parameters":[],"toolName":"sign","toolVersion":"6.2.9304.0"},{"keyCode":"CP-401405","operationSetCode":"NuGetVerify","parameters":[],"toolName":"sign","toolVersion":"6.2.9304.0"}] + diff --git a/.pipelines/v2/templates/steps-build-js.yml b/.pipelines/v2/templates/steps-build-js.yml index c8a2de78e..468b806c0 100644 --- a/.pipelines/v2/templates/steps-build-js.yml +++ b/.pipelines/v2/templates/steps-build-js.yml @@ -85,7 +85,7 @@ steps: displayName: 'npm ci' inputs: command: custom - workingDir: '$(Build.SourcesDirectory)/sdk_v2/js' + workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' customCommand: 'ci --no-audit --no-fund --ignore-scripts' # binding.gyp resolves the foundry_local lib + gsl/public include dirs @@ -98,7 +98,7 @@ steps: $arch = '${{ parameters.targetArch }}' $args = if ($arch -eq 'native') { 'rebuild' } else { "rebuild --arch=$arch" } Write-Host "node-gyp $args" - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npx --no-install node-gyp $args.Split(' ') if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build Node-API addon' @@ -109,18 +109,18 @@ steps: # Without this, print-prebuild-dir.mjs uses the host Node.js process.arch # (x64) and the addon lands in prebuilds/win32-x64/ even when we are # cross-compiling to arm64. - FOUNDRY_LOCAL_PREBUILD_DIR: '$(Build.SourcesDirectory)/sdk_v2/js/prebuilds/$(prebuildDir)' + FOUNDRY_LOCAL_PREBUILD_DIR: '$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds/$(prebuildDir)' - ${{ if or(eq(parameters.rid, 'linux-x64'), eq(parameters.rid, 'osx-arm64')) }}: - bash: | set -euo pipefail - cd "$(Build.SourcesDirectory)/sdk_v2/js" + cd "$(Build.Repository.LocalPath)/sdk_v2/js" npx --no-install node-gyp rebuild displayName: 'Build Node-API addon' env: FOUNDRY_LOCAL_LIB_DIR: '${{ parameters.nativeArtifactDir }}' FOUNDRY_LOCAL_INCLUDE_DIR: '${{ parameters.includeArtifactDir }}' - FOUNDRY_LOCAL_PREBUILD_DIR: '$(Build.SourcesDirectory)/sdk_v2/js/prebuilds/$(prebuildDir)' + FOUNDRY_LOCAL_PREBUILD_DIR: '$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds/$(prebuildDir)' # Stage prebuilds/-/ with the two .node addons + foundry_local # shared library. binding.gyp's copy_addon_to_prebuilds target already @@ -132,7 +132,7 @@ steps: if (Test-Path $dst) { Remove-Item -Recurse -Force $dst } New-Item -ItemType Directory -Force -Path $dst | Out-Null - $srcAddon = "$(Build.SourcesDirectory)/sdk_v2/js/prebuilds/$(prebuildDir)" + $srcAddon = "$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds/$(prebuildDir)" foreach ($file in @('foundry_local_node.node', 'foundry_local_preload.node')) { $path = Join-Path $srcAddon $file if (-not (Test-Path $path)) { throw "Addon not found: $path" } @@ -155,7 +155,7 @@ steps: rm -rf "$dst" mkdir -p "$dst" - srcAddon="$(Build.SourcesDirectory)/sdk_v2/js/prebuilds/$(prebuildDir)" + srcAddon="$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds/$(prebuildDir)" for file in foundry_local_node.node foundry_local_preload.node; do path="$srcAddon/$file" if [ ! -f "$path" ]; then echo "Addon not found: $path" >&2; exit 1; fi @@ -221,3 +221,4 @@ steps: inlineOperation: | [{"keyCode":"CP-401337","operationSetCode":"MacAppDeveloperSign","parameters":[{"parameterName":"hardening","parameterValue":"--options=runtime"}],"toolName":"sign","toolVersion":"1.0"}] + diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index ca6deef34..c7ebd6a25 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -53,7 +53,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -62,7 +62,7 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared @@ -84,7 +84,7 @@ steps: # side); test/example binaries are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' + src='$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" @@ -97,3 +97,4 @@ steps: echo " staged libfoundry_local.so" displayName: 'Stage native artifacts' + diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index e338cc2f4..be2049698 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -61,7 +61,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -70,7 +70,7 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared @@ -89,7 +89,7 @@ steps: # are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' + src='$(Build.Repository.LocalPath)/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" @@ -102,3 +102,4 @@ steps: echo " staged libfoundry_local.dylib" displayName: 'Stage native artifacts' + diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index 13cea2324..6ec6c9607 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -62,7 +62,7 @@ steps: targetType: inline pwsh: true script: | - $pyproject = "$(Build.SourcesDirectory)/sdk_v2/python/pyproject.toml" + $pyproject = "$(Build.Repository.LocalPath)/sdk_v2/python/pyproject.toml" $content = Get-Content $pyproject -Raw # Replace the first occurrence of `version = "..."` inside the # [project] table. The backend shim handles the package-name @@ -93,7 +93,7 @@ steps: targetType: inline pwsh: true script: | - $dest = "$(Build.SourcesDirectory)/sdk_v2/python/src/foundry_local_sdk/_native/${{ parameters.rid }}" + $dest = "$(Build.Repository.LocalPath)/sdk_v2/python/src/foundry_local_sdk/_native/${{ parameters.rid }}" if (Test-Path $dest) { Remove-Item -Recurse -Force $dest } New-Item -ItemType Directory -Force -Path $dest | Out-Null @@ -132,7 +132,7 @@ steps: targetType: inline pwsh: true script: | - $py = "$(Build.SourcesDirectory)/sdk_v2/python" + $py = "$(Build.Repository.LocalPath)/sdk_v2/python" # Remove stale, untagged cffi extension from prior dev compiles. # The wheel build below produces a properly ABI-tagged variant; the # untagged copy is bonus baggage we don't want shipped. @@ -285,7 +285,7 @@ steps: $extraArgs += '--config-setting=--build-option=--plat-name=win_arm64' Write-Host "Cross-compile: forcing wheel plat tag win_arm64" } - Push-Location "$(Build.SourcesDirectory)/sdk_v2/python" + Push-Location "$(Build.Repository.LocalPath)/sdk_v2/python" try { if ($targetArch -eq 'arm64') { # Run vcvarsall and the build in a single child cmd.exe process so the cross @@ -341,3 +341,4 @@ steps: Get-ChildItem "${{ parameters.outputDir }}" -Filter '*.whl' | ForEach-Object { Write-Host ("{0,12} {1}" -f $_.Length, $_.Name) } + diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 5a3fed67e..5bc820260 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -90,7 +90,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -104,7 +104,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64, WinML)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -117,7 +117,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -131,7 +131,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile, WinML)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -139,7 +139,7 @@ steps: - ${{ if and(eq(parameters.runTests, true), eq(parameters.arch, 'x64')) }}: - script: python build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)\test-data-shared @@ -161,8 +161,8 @@ steps: targetType: inline pwsh: true script: | - $binDir = '$(Build.SourcesDirectory)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' - $linkDir = '$(Build.SourcesDirectory)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' + $binDir = '$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' + $linkDir = '$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' $dst = '$(Build.ArtifactStagingDirectory)/native' New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -188,7 +188,7 @@ steps: - task: CopyFiles@2 displayName: 'Stage public headers' inputs: - SourceFolder: '$(Build.SourcesDirectory)/sdk_v2/cpp/include' + SourceFolder: '$(Build.Repository.LocalPath)/sdk_v2/cpp/include' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include' @@ -201,7 +201,8 @@ steps: - task: CopyFiles@2 displayName: 'Stage ms-gsl headers' inputs: - SourceFolder: '$(Build.SourcesDirectory)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' + SourceFolder: '$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include/gsl' + diff --git a/.pipelines/v2/templates/steps-pack-js.yml b/.pipelines/v2/templates/steps-pack-js.yml index 935fd753c..338eb9bae 100644 --- a/.pipelines/v2/templates/steps-pack-js.yml +++ b/.pipelines/v2/templates/steps-pack-js.yml @@ -28,7 +28,7 @@ steps: versionSpec: '20.x' - pwsh: | - $dst = "$(Build.SourcesDirectory)/sdk_v2/js/prebuilds" + $dst = "$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds" if (Test-Path $dst) { Remove-Item -Recurse -Force $dst } New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -53,19 +53,19 @@ steps: displayName: 'npm ci' inputs: command: custom - workingDir: '$(Build.SourcesDirectory)/sdk_v2/js' + workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' customCommand: 'ci --no-audit --no-fund --ignore-scripts' - pwsh: | $version = (Get-Content "$(Pipeline.Workspace)/version-info/sdkVersion.txt" -Raw).Trim() Write-Host "Stamping JS package version: $version" - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npm version $version --no-git-tag-version --allow-same-version if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Stamp package version' - pwsh: | - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npm run build:ts if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build TypeScript' @@ -73,9 +73,10 @@ steps: - pwsh: | $dst = '${{ parameters.outputDir }}' New-Item -ItemType Directory -Force -Path $dst | Out-Null - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npm pack --pack-destination $dst if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Get-ChildItem $dst | ForEach-Object { Write-Host " $($_.Name) $($_.Length) bytes" } displayName: 'npm pack' + diff --git a/.pipelines/v2/templates/steps-pack-nuget.yml b/.pipelines/v2/templates/steps-pack-nuget.yml index e61ad8e61..5ae85d980 100644 --- a/.pipelines/v2/templates/steps-pack-nuget.yml +++ b/.pipelines/v2/templates/steps-pack-nuget.yml @@ -60,7 +60,7 @@ steps: $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Build.SourcesDirectory)/sdk_v2/cpp/nuget/pack.py" ` + python "$(Build.Repository.LocalPath)/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime" ` --ort_version "${{ parameters.ortVersion }}" ` @@ -89,7 +89,7 @@ steps: $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Build.SourcesDirectory)/sdk_v2/cpp/nuget/pack.py" ` + python "$(Build.Repository.LocalPath)/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime.WinML" ` --ort_version "${{ parameters.ortVersion }}" ` @@ -101,3 +101,4 @@ steps: Write-Host "Generated packages:" Get-ChildItem $outDir -Filter '*.nupkg' | ForEach-Object { Write-Host " $($_.Name)" } + diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index b6dda473a..1036c4764 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -41,7 +41,7 @@ steps: pwsh: true script: | $ErrorActionPreference = 'Stop' - $depsFile = Join-Path "$(Build.SourcesDirectory)" "sdk_v2/deps_versions.json" + $depsFile = Join-Path "$(Build.Repository.LocalPath)" "sdk_v2/deps_versions.json" if (-not (Test-Path $depsFile)) { throw "deps_versions.json not found at $depsFile" } $deps = Get-Content $depsFile -Raw | ConvertFrom-Json $expected = @{ @@ -61,7 +61,7 @@ steps: if ($errors.Count -gt 0) { Write-Host "Version drift detected between pipeline literals and sdk_v2/deps_versions.json:" $errors | ForEach-Object { Write-Host $_ } - throw "Bump the matching cpp*Version variable in .pipelines/foundry-local-packaging.yml" + throw "Bump the matching cpp*Version variable in .pipelines/v2/foundry-local-packaging.yml" } Write-Host "Pinned versions agree with sdk_v2/deps_versions.json." @@ -168,3 +168,4 @@ steps: echo "cmakeFetchDefines = $joined" displayName: 'Pre-download NuGet packages' + diff --git a/.pipelines/v2/templates/steps-test-cs.yml b/.pipelines/v2/templates/steps-test-cs.yml index 0b2638fdf..47854e3b5 100644 --- a/.pipelines/v2/templates/steps-test-cs.yml +++ b/.pipelines/v2/templates/steps-test-cs.yml @@ -110,7 +110,7 @@ steps: targetType: inline pwsh: true script: | - $proj = "$(Build.SourcesDirectory)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" + $proj = "$(Build.Repository.LocalPath)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" $rid = dotnet msbuild $proj -getProperty:NETCoreSdkRuntimeIdentifier if ($LASTEXITCODE -ne 0 -or -not $rid) { throw "Failed to determine RuntimeIdentifier" } Write-Host "Restoring for RuntimeIdentifier: $rid" @@ -142,7 +142,7 @@ steps: # The redirect file foundry_local.native.cfg is a local-dev override that, if # present, takes priority in DllLoader and would silently point the loader at # an arbitrary path on the agent. Sweep it out of every bin folder before tests. - $root = "$(Build.SourcesDirectory)/sdk_v2/cs" + $root = "$(Build.Repository.LocalPath)/sdk_v2/cs" $stale = Get-ChildItem -Path $root -Recurse -Force -Filter 'foundry_local.native.cfg' -ErrorAction SilentlyContinue if ($stale) { Write-Host "Removing stale redirect files:" @@ -157,7 +157,7 @@ steps: targetType: inline pwsh: true script: | - $proj = "$(Build.SourcesDirectory)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" + $proj = "$(Build.Repository.LocalPath)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" # Test TFMs: # * net9.0 covers the .NET (Core) runtime test surface. @@ -186,3 +186,4 @@ steps: TF_BUILD: 'true' FOUNDRY_TEST_DATA_DIR: ${{ parameters.testDataSharedDir }} + diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index e88eef1ee..37af15f6a 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -26,7 +26,7 @@ steps: - ${{ if eq(parameters.rid, 'win-x64') }}: - pwsh: | $src = "${{ parameters.prebuildArtifactDir }}/prebuilds" - $dst = "$(Build.SourcesDirectory)/sdk_v2/js/prebuilds" + $dst = "$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds" if (-not (Test-Path $src)) { throw "Prebuild artifact missing: $src" } if (Test-Path $dst) { Remove-Item -Recurse -Force $dst } New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -38,7 +38,7 @@ steps: - bash: | set -euo pipefail src="${{ parameters.prebuildArtifactDir }}/prebuilds" - dst="$(Build.SourcesDirectory)/sdk_v2/js/prebuilds" + dst="$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds" if [ ! -d "$src" ]; then echo "Prebuild artifact missing: $src" >&2; exit 1; fi rm -rf "$dst" mkdir -p "$dst" @@ -51,17 +51,17 @@ steps: displayName: 'npm ci (runs install-native postinstall)' inputs: command: custom - workingDir: '$(Build.SourcesDirectory)/sdk_v2/js' + workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' customCommand: 'ci --no-audit --no-fund' - pwsh: | - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npm run build:ts if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build TypeScript' - pwsh: | - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npx --no-install vitest run --reporter=verbose if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Run vitest' @@ -71,21 +71,22 @@ steps: - ${{ if or(eq(parameters.rid, 'linux-x64'), eq(parameters.rid, 'osx-arm64')) }}: - bash: | set -euo pipefail - cd "$(Build.SourcesDirectory)/sdk_v2/js" + cd "$(Build.Repository.LocalPath)/sdk_v2/js" npm ci --no-audit --no-fund displayName: 'npm ci (runs install-native postinstall)' - bash: | set -euo pipefail - cd "$(Build.SourcesDirectory)/sdk_v2/js" + cd "$(Build.Repository.LocalPath)/sdk_v2/js" npm run build:ts displayName: 'Build TypeScript' - bash: | set -euo pipefail - cd "$(Build.SourcesDirectory)/sdk_v2/js" + cd "$(Build.Repository.LocalPath)/sdk_v2/js" npx --no-install vitest run --reporter=verbose displayName: 'Run vitest' env: FOUNDRY_TEST_DATA_DIR: '${{ parameters.testDataSharedDir }}' + diff --git a/.pipelines/v2/templates/steps-test-python.yml b/.pipelines/v2/templates/steps-test-python.yml index cb46fab01..e36fd085f 100644 --- a/.pipelines/v2/templates/steps-test-python.yml +++ b/.pipelines/v2/templates/steps-test-python.yml @@ -80,7 +80,7 @@ steps: targetType: inline pwsh: true script: | - Push-Location "$(Build.SourcesDirectory)/sdk_v2/python" + Push-Location "$(Build.Repository.LocalPath)/sdk_v2/python" try { # Override pythonpath = ["src"] from pyproject.toml so pytest # imports the installed wheel (which contains the compiled cffi @@ -96,3 +96,4 @@ steps: TF_BUILD: 'true' FOUNDRY_TEST_DATA_DIR: ${{ parameters.testDataSharedDir }} + From 95562db19053840bbc3e9eb53e5b0480195653d4 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Tue, 23 Jun 2026 18:08:58 -0700 Subject: [PATCH 05/35] test --- .../v2/templates/steps-prefetch-nuget.yml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 1036c4764..b8cb71162 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -41,8 +41,24 @@ steps: pwsh: true script: | $ErrorActionPreference = 'Stop' - $depsFile = Join-Path "$(Build.Repository.LocalPath)" "sdk_v2/deps_versions.json" - if (-not (Test-Path $depsFile)) { throw "deps_versions.json not found at $depsFile" } + + $repoName = "$(Build.Repository.Name)" + $repoNameLeaf = ($repoName -split '/')[-1] + $candidatePaths = @( + (Join-Path "$(Build.Repository.LocalPath)" "sdk_v2/deps_versions.json"), + (Join-Path "$(Build.SourcesDirectory)" "sdk_v2/deps_versions.json"), + (Join-Path "$(Build.SourcesDirectory)" "$repoNameLeaf/sdk_v2/deps_versions.json"), + (Join-Path "$(Pipeline.Workspace)/s" "$repoNameLeaf/sdk_v2/deps_versions.json") + ) + + $depsFile = $candidatePaths | Where-Object { Test-Path $_ } | Select-Object -First 1 + if (-not $depsFile) { + Write-Host "Checked paths for deps_versions.json:" + $candidatePaths | ForEach-Object { Write-Host " $_" } + throw "deps_versions.json not found in any expected self-repo checkout location" + } + + Write-Host "Using deps_versions.json at: $depsFile" $deps = Get-Content $depsFile -Raw | ConvertFrom-Json $expected = @{ 'onnxruntime' = '${{ parameters.ortVersion }}' From c491511bfc1ccffc25b7931c7d26aaf6610772a2 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 09:03:03 -0700 Subject: [PATCH 06/35] deps --- .pipelines/v2/templates/steps-prefetch-nuget.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index b8cb71162..9d6d19c69 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -51,6 +51,19 @@ steps: (Join-Path "$(Pipeline.Workspace)/s" "$repoNameLeaf/sdk_v2/deps_versions.json") ) + $searchRoots = @("$(Build.Repository.LocalPath)", "$(Build.SourcesDirectory)", "$(Pipeline.Workspace)/s") | + Where-Object { $_ -and (Test-Path $_) } | + Select-Object -Unique + + foreach ($root in $searchRoots) { + $found = Get-ChildItem -Path $root -Filter deps_versions.json -File -Recurse -ErrorAction SilentlyContinue | + Where-Object { $_.FullName -match '[\\/]sdk_v2[\\/]deps_versions\.json$' } | + Select-Object -ExpandProperty FullName + if ($found) { $candidatePaths += $found } + } + + $candidatePaths = $candidatePaths | Where-Object { $_ } | Select-Object -Unique + $depsFile = $candidatePaths | Where-Object { Test-Path $_ } | Select-Object -First 1 if (-not $depsFile) { Write-Host "Checked paths for deps_versions.json:" From 0ed2dffba6fafb67e711bb476f60ee3bf98cfb1f Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 09:41:32 -0700 Subject: [PATCH 07/35] checkout --- .pipelines/v2/templates/steps-build-linux.yml | 3 ++ .pipelines/v2/templates/steps-build-macos.yml | 3 ++ .../v2/templates/steps-build-windows.yml | 3 ++ .../v2/templates/steps-prefetch-nuget.yml | 31 ++----------------- 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index c7ebd6a25..e3b700ba0 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -17,6 +17,9 @@ parameters: steps: +- checkout: self + clean: true + - bash: | set -euo pipefail git clone https://github.com/microsoft/vcpkg.git "$(Build.BinariesDirectory)/vcpkg" diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index be2049698..aaa89ff45 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -15,6 +15,9 @@ parameters: steps: +- checkout: self + clean: true + - bash: | set -euo pipefail git clone https://github.com/microsoft/vcpkg.git "$(Build.BinariesDirectory)/vcpkg" diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 5bc820260..2d010f8e5 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -38,6 +38,9 @@ parameters: steps: +- checkout: self + clean: true + # Windows hosted agents don't have python on PATH by default — the launcher # stub redirects to the Microsoft Store. UsePythonVersion installs and adds it # to PATH for the rest of the job. arm64 builds cross-compile on the x64 diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 9d6d19c69..cf2c00483 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -41,34 +41,9 @@ steps: pwsh: true script: | $ErrorActionPreference = 'Stop' - - $repoName = "$(Build.Repository.Name)" - $repoNameLeaf = ($repoName -split '/')[-1] - $candidatePaths = @( - (Join-Path "$(Build.Repository.LocalPath)" "sdk_v2/deps_versions.json"), - (Join-Path "$(Build.SourcesDirectory)" "sdk_v2/deps_versions.json"), - (Join-Path "$(Build.SourcesDirectory)" "$repoNameLeaf/sdk_v2/deps_versions.json"), - (Join-Path "$(Pipeline.Workspace)/s" "$repoNameLeaf/sdk_v2/deps_versions.json") - ) - - $searchRoots = @("$(Build.Repository.LocalPath)", "$(Build.SourcesDirectory)", "$(Pipeline.Workspace)/s") | - Where-Object { $_ -and (Test-Path $_) } | - Select-Object -Unique - - foreach ($root in $searchRoots) { - $found = Get-ChildItem -Path $root -Filter deps_versions.json -File -Recurse -ErrorAction SilentlyContinue | - Where-Object { $_.FullName -match '[\\/]sdk_v2[\\/]deps_versions\.json$' } | - Select-Object -ExpandProperty FullName - if ($found) { $candidatePaths += $found } - } - - $candidatePaths = $candidatePaths | Where-Object { $_ } | Select-Object -Unique - - $depsFile = $candidatePaths | Where-Object { Test-Path $_ } | Select-Object -First 1 - if (-not $depsFile) { - Write-Host "Checked paths for deps_versions.json:" - $candidatePaths | ForEach-Object { Write-Host " $_" } - throw "deps_versions.json not found in any expected self-repo checkout location" + $depsFile = Join-Path "$(Build.Repository.LocalPath)" "sdk_v2/deps_versions.json" + if (-not (Test-Path $depsFile)) { + throw "deps_versions.json not found at $depsFile" } Write-Host "Using deps_versions.json at: $depsFile" From a7bbf361bc7539d8e5c25ad32360514f634f6ea5 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 10:34:30 -0700 Subject: [PATCH 08/35] pls work --- .pipelines/v2/templates/steps-prefetch-nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index cf2c00483..df5790cbe 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -41,7 +41,7 @@ steps: pwsh: true script: | $ErrorActionPreference = 'Stop' - $depsFile = Join-Path "$(Build.Repository.LocalPath)" "sdk_v2/deps_versions.json" + $depsFile = Join-Path "$(Build.SourcesDirectory)/Foundry-Local" "sdk_v2/deps_versions.json" if (-not (Test-Path $depsFile)) { throw "deps_versions.json not found at $depsFile" } From 0e67873bc56feb4cc94d5bc3a5fe17dc27d6a73d Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 11:53:24 -0700 Subject: [PATCH 09/35] nuget --- .../v2/templates/steps-prefetch-nuget.yml | 60 +++++++++++++++---- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index df5790cbe..aba9ce7f2 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -80,11 +80,49 @@ steps: $cacheDir = "$(Build.BinariesDirectory)/nuget_packages" New-Item -ItemType Directory -Force -Path $cacheDir | Out-Null - # All four packages are public on nuget.org. Foundry Local Core's - # nuget.config maps everything except Microsoft.Telemetry* to nuget.org - # (see .pipelines/templates/build-core-steps.yml), so we follow the - # same source of truth here. - $feed = "https://www.nuget.org/api/v2/package" + $nugetCmd = Get-Command nuget -ErrorAction SilentlyContinue + if (-not $nugetCmd) { + throw "nuget CLI not found on PATH. This step uses nuget install to fetch package artifacts." + } + + function Install-NuGetPackage { + param( + [string]$Id, + [string]$Version, + [string]$OutDir + ) + + $pkgDir = Join-Path $OutDir $Id + if (Test-Path $pkgDir) { + Remove-Item -Recurse -Force $pkgDir + } + + $nugetArgs = @( + 'install', $Id, + '-Version', $Version, + '-Source', 'https://api.nuget.org/v3/index.json', + '-OutputDirectory', $OutDir, + '-ExcludeVersion', + '-NonInteractive', + '-DirectDownload', + '-PackageSaveMode', 'nupkg' + ) + + Write-Host "Running: nuget $($nugetArgs -join ' ')" + & nuget $nugetArgs + if ($LASTEXITCODE -ne 0) { + throw "nuget install failed for $Id $Version" + } + + $nupkg = Get-ChildItem -Path $pkgDir -Filter '*.nupkg' -File -Recurse -ErrorAction SilentlyContinue | + Sort-Object LastWriteTime -Descending | + Select-Object -First 1 + if (-not $nupkg) { + throw "nuget install did not produce a .nupkg under $pkgDir" + } + + return $nupkg.FullName + } $packages = @( @{ key = 'genai'; id = 'Microsoft.ML.OnnxRuntimeGenAI.Foundry'; version = '${{ parameters.genaiVersion }}' }, @@ -96,10 +134,8 @@ steps: $defines = @() foreach ($pkg in $packages) { - $url = "$feed/$($pkg.id)/$($pkg.version)" - $out = "$cacheDir/$($pkg.key).nupkg" - Write-Host "Downloading $($pkg.id) $($pkg.version)" - Invoke-WebRequest -Uri $url -OutFile $out -UseBasicParsing + Write-Host "Downloading $($pkg.id) $($pkg.version) via nuget install" + $out = Install-NuGetPackage -Id $pkg.id -Version $pkg.version -OutDir $cacheDir if (-not (Test-Path $out)) { throw "$($pkg.key) download failed" } Write-Host " -> $out ($((Get-Item $out).Length) bytes)" @@ -113,10 +149,8 @@ steps: if ($${{ parameters.includeWinml }}) { # WinML 2.x (Microsoft.Windows.AI.MachineLearning) is reg-free — a single self-contained # native package with no transitive Windows App SDK Foundation dependency to resolve. - $winmlUrl = "$feed/Microsoft.Windows.AI.MachineLearning/${{ parameters.winmlVersion }}" - $winmlOut = "$cacheDir/winml.nupkg" - Write-Host "Downloading Microsoft.Windows.AI.MachineLearning ${{ parameters.winmlVersion }}" - Invoke-WebRequest -Uri $winmlUrl -OutFile $winmlOut + Write-Host "Downloading Microsoft.Windows.AI.MachineLearning ${{ parameters.winmlVersion }} via nuget install" + $winmlOut = Install-NuGetPackage -Id 'Microsoft.Windows.AI.MachineLearning' -Version '${{ parameters.winmlVersion }}' -OutDir $cacheDir if (-not (Test-Path $winmlOut)) { throw "WinML download failed" } Write-Host " -> $winmlOut ($((Get-Item $winmlOut).Length) bytes)" $defines += "WINML_EP_CATALOG_FETCH_URL=$winmlOut" From 308e6208e1749e0a8c8191a17ee7704f1f149520 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 12:55:59 -0700 Subject: [PATCH 10/35] AIFoundrylocal_PublicPackages --- .pipelines/v2/templates/steps-prefetch-nuget.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index aba9ce7f2..5fb2475d5 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -70,6 +70,9 @@ steps: Write-Host "Pinned versions agree with sdk_v2/deps_versions.json." - ${{ if eq(parameters.shell, 'pwsh') }}: + - task: NuGetAuthenticate@1 + displayName: 'Authenticate NuGet feeds' + - task: PowerShell@2 displayName: 'Pre-download NuGet packages' inputs: @@ -100,7 +103,7 @@ steps: $nugetArgs = @( 'install', $Id, '-Version', $Version, - '-Source', 'https://api.nuget.org/v3/index.json', + '-Source', 'https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/nuget/v3/index.json', '-OutputDirectory', $OutDir, '-ExcludeVersion', '-NonInteractive', From d5642f43fa979341676bba6ec772de6b68248887 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 13:30:40 -0700 Subject: [PATCH 11/35] path --- .pipelines/v2/templates/steps-build-macos.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index aaa89ff45..e750e9988 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -64,7 +64,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -73,7 +73,7 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared @@ -92,7 +92,7 @@ steps: # are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.Repository.LocalPath)/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' + src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" From e739f89f753fddc59d052600cef9f5a225d5e1dc Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 14:20:14 -0700 Subject: [PATCH 12/35] nuget --- .../v2/templates/steps-prefetch-nuget.yml | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 5fb2475d5..1b28eaac7 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -124,7 +124,12 @@ steps: throw "nuget install did not produce a .nupkg under $pkgDir" } - return $nupkg.FullName + $resolvedPath = $nupkg | Select-Object -ExpandProperty FullName -First 1 + if ([string]::IsNullOrWhiteSpace($resolvedPath)) { + throw "nuget install produced an invalid path under $pkgDir" + } + + return $resolvedPath } $packages = @( @@ -139,13 +144,14 @@ steps: foreach ($pkg in $packages) { Write-Host "Downloading $($pkg.id) $($pkg.version) via nuget install" $out = Install-NuGetPackage -Id $pkg.id -Version $pkg.version -OutDir $cacheDir - if (-not (Test-Path $out)) { throw "$($pkg.key) download failed" } - Write-Host " -> $out ($((Get-Item $out).Length) bytes)" + if ([string]::IsNullOrWhiteSpace($out)) { throw "$($pkg.key) download failed" } + $downloaded = Get-Item -LiteralPath $out -ErrorAction Stop + Write-Host " -> $($downloaded.FullName) ($($downloaded.Length) bytes)" switch ($pkg.key) { - 'genai' { $defines += "GENAI_FETCH_URL=$out" } - 'ort' { $defines += "ORT_FETCH_URL=$out" } - 'ort_gpu_linux' { $defines += "ORT_GPU_LINUX_FETCH_URL=$out" } + 'genai' { $defines += "GENAI_FETCH_URL=$($downloaded.FullName)" } + 'ort' { $defines += "ORT_FETCH_URL=$($downloaded.FullName)" } + 'ort_gpu_linux' { $defines += "ORT_GPU_LINUX_FETCH_URL=$($downloaded.FullName)" } } } @@ -154,9 +160,10 @@ steps: # native package with no transitive Windows App SDK Foundation dependency to resolve. Write-Host "Downloading Microsoft.Windows.AI.MachineLearning ${{ parameters.winmlVersion }} via nuget install" $winmlOut = Install-NuGetPackage -Id 'Microsoft.Windows.AI.MachineLearning' -Version '${{ parameters.winmlVersion }}' -OutDir $cacheDir - if (-not (Test-Path $winmlOut)) { throw "WinML download failed" } - Write-Host " -> $winmlOut ($((Get-Item $winmlOut).Length) bytes)" - $defines += "WINML_EP_CATALOG_FETCH_URL=$winmlOut" + if ([string]::IsNullOrWhiteSpace($winmlOut)) { throw "WinML download failed" } + $winmlDownloaded = Get-Item -LiteralPath $winmlOut -ErrorAction Stop + Write-Host " -> $($winmlDownloaded.FullName) ($($winmlDownloaded.Length) bytes)" + $defines += "WINML_EP_CATALOG_FETCH_URL=$($winmlDownloaded.FullName)" } $joined = ($defines | ForEach-Object { "`"$_`"" }) -join ' ' From 96c776ca25eb7b14b335de85e8b1baaf3cf5080d Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 14:21:03 -0700 Subject: [PATCH 13/35] type --- .pipelines/v2/templates/steps-build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index e750e9988..05e6bbf4f 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -92,7 +92,7 @@ steps: # are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' + src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" From 7bca85b3b594754cfd0a536534bfd60ecb8b11b7 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 14:48:46 -0700 Subject: [PATCH 14/35] bug fixes --- .pipelines/v2/templates/stages-cs.yml | 19 ++++++++---- .pipelines/v2/templates/stages-js.yml | 25 ++++++++++----- .pipelines/v2/templates/stages-python.yml | 31 +++++++++++++------ .pipelines/v2/templates/steps-build-cs.yml | 1 - .pipelines/v2/templates/steps-build-linux.yml | 3 +- .pipelines/v2/templates/steps-build-macos.yml | 3 +- .../v2/templates/steps-build-python.yml | 9 ++++-- .../v2/templates/steps-build-windows.yml | 3 +- .../v2/templates/steps-prefetch-nuget.yml | 15 +++++---- .pipelines/v2/templates/steps-test-cs.yml | 1 - 10 files changed, 72 insertions(+), 38 deletions(-) diff --git a/.pipelines/v2/templates/stages-cs.yml b/.pipelines/v2/templates/stages-cs.yml index a791d7d5e..8b54fb9e1 100644 --- a/.pipelines/v2/templates/stages-cs.yml +++ b/.pipelines/v2/templates/stages-cs.yml @@ -65,7 +65,8 @@ stages: artifactName: ${{ parameters._config_base.csArtifact }} targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-cs.yml parameters: @@ -97,7 +98,8 @@ stages: artifactName: ${{ parameters._config_winml.csArtifact }} targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-cs.yml parameters: @@ -127,7 +129,8 @@ stages: artifactName: ${{ parameters._config_base.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -156,7 +159,8 @@ stages: artifactName: ${{ parameters._config_winml.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_winml.nativeArtifact }}' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -188,7 +192,8 @@ stages: artifactName: ${{ parameters._config_base.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -218,7 +223,8 @@ stages: artifactName: ${{ parameters._config_base.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - bash: | set -euo pipefail @@ -237,3 +243,4 @@ stages: additionalTestArgs: '--settings $(Build.Repository.LocalPath)/sdk_v2/cs/test/FoundryLocal.Tests/sequential.runsettings' + diff --git a/.pipelines/v2/templates/stages-js.yml b/.pipelines/v2/templates/stages-js.yml index c35af7e49..ea0720e53 100644 --- a/.pipelines/v2/templates/stages-js.yml +++ b/.pipelines/v2/templates/stages-js.yml @@ -50,7 +50,8 @@ stages: artifactName: 'js-prebuild-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -89,7 +90,8 @@ stages: artifactName: 'js-prebuild-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -127,7 +129,8 @@ stages: artifactName: 'js-prebuild-linux-x64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -167,7 +170,8 @@ stages: artifactName: 'js-prebuild-osx-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -196,7 +200,8 @@ stages: artifactName: 'js-prebuild-win-x64' targetPath: '$(Pipeline.Workspace)/js-prebuild-win-x64' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -221,7 +226,8 @@ stages: artifactName: 'js-prebuild-linux-x64' targetPath: '$(Pipeline.Workspace)/js-prebuild-linux-x64' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -248,7 +254,8 @@ stages: artifactName: 'js-prebuild-osx-arm64' targetPath: '$(Pipeline.Workspace)/js-prebuild-osx-arm64' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - bash: | set -euo pipefail @@ -303,9 +310,11 @@ stages: artifactName: 'js-sdk-v2' targetPath: '$(Build.ArtifactStagingDirectory)/js-sdk-v2' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-pack-js.yml parameters: outputDir: '$(Build.ArtifactStagingDirectory)/js-sdk-v2' + diff --git a/.pipelines/v2/templates/stages-python.yml b/.pipelines/v2/templates/stages-python.yml index f43e1c0cb..0b265ac5b 100644 --- a/.pipelines/v2/templates/stages-python.yml +++ b/.pipelines/v2/templates/stages-python.yml @@ -48,7 +48,8 @@ stages: artifactName: 'python-sdk-base-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -80,7 +81,8 @@ stages: artifactName: 'python-sdk-base-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -113,7 +115,8 @@ stages: artifactName: 'python-sdk-base-linux-x64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -147,7 +150,8 @@ stages: artifactName: 'python-sdk-base-osx-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -176,7 +180,8 @@ stages: artifactName: 'python-sdk-base-win-x64' targetPath: '$(Pipeline.Workspace)/python-sdk-base-win-x64' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -201,7 +206,8 @@ stages: artifactName: 'python-sdk-base-linux-x64' targetPath: '$(Pipeline.Workspace)/python-sdk-base-linux-x64' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -228,7 +234,8 @@ stages: artifactName: 'python-sdk-base-osx-arm64' targetPath: '$(Pipeline.Workspace)/python-sdk-base-osx-arm64' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - bash: | set -euo pipefail @@ -274,7 +281,8 @@ stages: artifactName: 'python-sdk-winml-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -306,7 +314,8 @@ stages: artifactName: 'python-sdk-winml-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -331,7 +340,8 @@ stages: artifactName: 'python-sdk-winml-win-x64' targetPath: '$(Pipeline.Workspace)/python-sdk-winml-win-x64' steps: - - checkout: self +- checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -341,3 +351,4 @@ stages: testDataSharedDir: '$(Build.SourcesDirectory)/test-data-shared' isWinML: true + diff --git a/.pipelines/v2/templates/steps-build-cs.yml b/.pipelines/v2/templates/steps-build-cs.yml index 8626bae15..abf05f678 100644 --- a/.pipelines/v2/templates/steps-build-cs.yml +++ b/.pipelines/v2/templates/steps-build-cs.yml @@ -69,7 +69,6 @@ steps: - diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index e3b700ba0..8e920afed 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -16,8 +16,8 @@ parameters: default: false steps: - - checkout: self + path: Foundry-Local clean: true - bash: | @@ -101,3 +101,4 @@ steps: displayName: 'Stage native artifacts' + diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index 05e6bbf4f..55b27435b 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -14,8 +14,8 @@ parameters: default: false steps: - - checkout: self + path: Foundry-Local clean: true - bash: | @@ -106,3 +106,4 @@ steps: displayName: 'Stage native artifacts' + diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index 6ec6c9607..cf4f4b386 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -163,6 +163,9 @@ steps: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - ${{ if eq(parameters.targetArch, 'arm64') }}: + - task: NuGetAuthenticate@1 + displayName: 'Authenticate NuGet feeds' + - task: PowerShell@2 displayName: 'Locate MSVC arm64 cross-tools (vswhere)' inputs: @@ -224,12 +227,12 @@ steps: New-Item -ItemType Directory -Force -Path $stageRoot | Out-Null # nuget.exe is on PATH on Microsoft-hosted Windows agents and on most - # self-hosted ones. The package is on nuget.org; -Source pins it - # explicitly so a misconfigured local nuget.config can't redirect us. + # self-hosted ones. Pull through the AIFoundryLocal feed (upstreamed + # to nuget.org) to avoid direct nuget.org network dependency. & nuget install pythonarm64 ` -Version 3.12.10 ` -OutputDirectory $stageRoot ` - -Source 'https://api.nuget.org/v3/index.json' ` + -Source 'https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/nuget/v3/index.json' ` -ExcludeVersion ` -NonInteractive if ($LASTEXITCODE -ne 0) { throw "nuget install pythonarm64 failed ($LASTEXITCODE)" } diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 2d010f8e5..bb4d7b08e 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -37,8 +37,8 @@ parameters: default: false steps: - - checkout: self + path: Foundry-Local clean: true # Windows hosted agents don't have python on PATH by default — the launcher @@ -209,3 +209,4 @@ steps: TargetFolder: '$(Build.ArtifactStagingDirectory)/include/gsl' + diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 1b28eaac7..5e0410723 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -112,7 +112,9 @@ steps: ) Write-Host "Running: nuget $($nugetArgs -join ' ')" - & nuget $nugetArgs + # nuget writes status lines to stdout; forward them to logs but keep + # this function's output channel reserved for the return path. + & nuget $nugetArgs | ForEach-Object { Write-Host $_ } if ($LASTEXITCODE -ne 0) { throw "nuget install failed for $Id $Version" } @@ -171,16 +173,17 @@ steps: Write-Host "cmakeFetchDefines = $joined" - ${{ if eq(parameters.shell, 'bash') }}: + - task: NuGetAuthenticate@1 + displayName: 'Authenticate NuGet feeds' + - bash: | set -euo pipefail cacheDir="$(Build.BinariesDirectory)/nuget_packages" mkdir -p "$cacheDir" - # All four packages are public on nuget.org. Foundry Local Core's - # nuget.config maps everything except Microsoft.Telemetry* to nuget.org - # (see .pipelines/templates/build-core-steps.yml), so we follow the - # same source of truth here. - feed="https://www.nuget.org/api/v2/package" + # Use the AIFoundryLocal feed (with upstream to nuget.org) so restricted + # build agents do not need direct connectivity to www.nuget.org. + feed="https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/nuget/v2/package" declare -a entries=( "genai:Microsoft.ML.OnnxRuntimeGenAI.Foundry:${{ parameters.genaiVersion }}" diff --git a/.pipelines/v2/templates/steps-test-cs.yml b/.pipelines/v2/templates/steps-test-cs.yml index 47854e3b5..ed8bcf5aa 100644 --- a/.pipelines/v2/templates/steps-test-cs.yml +++ b/.pipelines/v2/templates/steps-test-cs.yml @@ -67,7 +67,6 @@ steps: - From ce74beb25966e4c6474463e8c7309b0538afb3de Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 14:50:52 -0700 Subject: [PATCH 15/35] indents --- .pipelines/v2/templates/stages-cs.yml | 26 +++++++------- .pipelines/v2/templates/stages-js.yml | 34 +++++++++--------- .pipelines/v2/templates/stages-python.yml | 42 ++++++++++++----------- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/.pipelines/v2/templates/stages-cs.yml b/.pipelines/v2/templates/stages-cs.yml index 8b54fb9e1..250182cc3 100644 --- a/.pipelines/v2/templates/stages-cs.yml +++ b/.pipelines/v2/templates/stages-cs.yml @@ -65,8 +65,8 @@ stages: artifactName: ${{ parameters._config_base.csArtifact }} targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-cs.yml parameters: @@ -98,8 +98,8 @@ stages: artifactName: ${{ parameters._config_winml.csArtifact }} targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-cs.yml parameters: @@ -129,8 +129,8 @@ stages: artifactName: ${{ parameters._config_base.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -159,8 +159,8 @@ stages: artifactName: ${{ parameters._config_winml.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_winml.nativeArtifact }}' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -192,8 +192,8 @@ stages: artifactName: ${{ parameters._config_base.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -223,8 +223,8 @@ stages: artifactName: ${{ parameters._config_base.nativeArtifact }} targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - bash: | set -euo pipefail @@ -244,3 +244,5 @@ stages: + + diff --git a/.pipelines/v2/templates/stages-js.yml b/.pipelines/v2/templates/stages-js.yml index ea0720e53..2398ff2a3 100644 --- a/.pipelines/v2/templates/stages-js.yml +++ b/.pipelines/v2/templates/stages-js.yml @@ -50,8 +50,8 @@ stages: artifactName: 'js-prebuild-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -90,8 +90,8 @@ stages: artifactName: 'js-prebuild-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -129,8 +129,8 @@ stages: artifactName: 'js-prebuild-linux-x64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -170,8 +170,8 @@ stages: artifactName: 'js-prebuild-osx-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -200,8 +200,8 @@ stages: artifactName: 'js-prebuild-win-x64' targetPath: '$(Pipeline.Workspace)/js-prebuild-win-x64' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -226,8 +226,8 @@ stages: artifactName: 'js-prebuild-linux-x64' targetPath: '$(Pipeline.Workspace)/js-prebuild-linux-x64' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -254,8 +254,8 @@ stages: artifactName: 'js-prebuild-osx-arm64' targetPath: '$(Pipeline.Workspace)/js-prebuild-osx-arm64' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - bash: | set -euo pipefail @@ -310,11 +310,13 @@ stages: artifactName: 'js-sdk-v2' targetPath: '$(Build.ArtifactStagingDirectory)/js-sdk-v2' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-pack-js.yml parameters: outputDir: '$(Build.ArtifactStagingDirectory)/js-sdk-v2' + + diff --git a/.pipelines/v2/templates/stages-python.yml b/.pipelines/v2/templates/stages-python.yml index 0b265ac5b..1557bc549 100644 --- a/.pipelines/v2/templates/stages-python.yml +++ b/.pipelines/v2/templates/stages-python.yml @@ -48,8 +48,8 @@ stages: artifactName: 'python-sdk-base-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -81,8 +81,8 @@ stages: artifactName: 'python-sdk-base-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -115,8 +115,8 @@ stages: artifactName: 'python-sdk-base-linux-x64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -150,8 +150,8 @@ stages: artifactName: 'python-sdk-base-osx-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -180,8 +180,8 @@ stages: artifactName: 'python-sdk-base-win-x64' targetPath: '$(Pipeline.Workspace)/python-sdk-base-win-x64' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -206,8 +206,8 @@ stages: artifactName: 'python-sdk-base-linux-x64' targetPath: '$(Pipeline.Workspace)/python-sdk-base-linux-x64' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -234,8 +234,8 @@ stages: artifactName: 'python-sdk-base-osx-arm64' targetPath: '$(Pipeline.Workspace)/python-sdk-base-osx-arm64' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - bash: | set -euo pipefail @@ -281,8 +281,8 @@ stages: artifactName: 'python-sdk-winml-win-x64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -314,8 +314,8 @@ stages: artifactName: 'python-sdk-winml-win-arm64' targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -340,8 +340,8 @@ stages: artifactName: 'python-sdk-winml-win-x64' targetPath: '$(Pipeline.Workspace)/python-sdk-winml-win-x64' steps: -- checkout: self - path: Foundry-Local + - checkout: self + path: Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -352,3 +352,5 @@ stages: isWinML: true + + From fdc735dd417e1cf6dc2e82ef14e32b82f24848a4 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 15:12:31 -0700 Subject: [PATCH 16/35] /s --- .pipelines/v2/templates/stages-cs.yml | 13 ++++++------ .pipelines/v2/templates/stages-js.yml | 17 ++++++++------- .pipelines/v2/templates/stages-python.yml | 21 ++++++++++--------- .pipelines/v2/templates/steps-build-linux.yml | 3 ++- .pipelines/v2/templates/steps-build-macos.yml | 3 ++- .../v2/templates/steps-build-windows.yml | 3 ++- 6 files changed, 33 insertions(+), 27 deletions(-) diff --git a/.pipelines/v2/templates/stages-cs.yml b/.pipelines/v2/templates/stages-cs.yml index 250182cc3..8a3008f9a 100644 --- a/.pipelines/v2/templates/stages-cs.yml +++ b/.pipelines/v2/templates/stages-cs.yml @@ -66,7 +66,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-cs.yml parameters: @@ -99,7 +99,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/cs-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-cs.yml parameters: @@ -130,7 +130,7 @@ stages: targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -160,7 +160,7 @@ stages: targetPath: '$(Pipeline.Workspace)/${{ parameters._config_winml.nativeArtifact }}' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -193,7 +193,7 @@ stages: targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -224,7 +224,7 @@ stages: targetPath: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - bash: | set -euo pipefail @@ -246,3 +246,4 @@ stages: + diff --git a/.pipelines/v2/templates/stages-js.yml b/.pipelines/v2/templates/stages-js.yml index 2398ff2a3..9c0fe99c6 100644 --- a/.pipelines/v2/templates/stages-js.yml +++ b/.pipelines/v2/templates/stages-js.yml @@ -51,7 +51,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -91,7 +91,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -130,7 +130,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -171,7 +171,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/js-prebuild' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-js.yml parameters: @@ -201,7 +201,7 @@ stages: targetPath: '$(Pipeline.Workspace)/js-prebuild-win-x64' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -227,7 +227,7 @@ stages: targetPath: '$(Pipeline.Workspace)/js-prebuild-linux-x64' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -255,7 +255,7 @@ stages: targetPath: '$(Pipeline.Workspace)/js-prebuild-osx-arm64' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - bash: | set -euo pipefail @@ -311,7 +311,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/js-sdk-v2' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-pack-js.yml parameters: @@ -320,3 +320,4 @@ stages: + diff --git a/.pipelines/v2/templates/stages-python.yml b/.pipelines/v2/templates/stages-python.yml index 1557bc549..11655812c 100644 --- a/.pipelines/v2/templates/stages-python.yml +++ b/.pipelines/v2/templates/stages-python.yml @@ -49,7 +49,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -82,7 +82,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -116,7 +116,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -151,7 +151,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -181,7 +181,7 @@ stages: targetPath: '$(Pipeline.Workspace)/python-sdk-base-win-x64' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -207,7 +207,7 @@ stages: targetPath: '$(Pipeline.Workspace)/python-sdk-base-linux-x64' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -235,7 +235,7 @@ stages: targetPath: '$(Pipeline.Workspace)/python-sdk-base-osx-arm64' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - bash: | set -euo pipefail @@ -282,7 +282,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -315,7 +315,7 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/python-sdk' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - template: steps-build-python.yml parameters: @@ -341,7 +341,7 @@ stages: targetPath: '$(Pipeline.Workspace)/python-sdk-winml-win-x64' steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - checkout: test-data-shared lfs: true @@ -354,3 +354,4 @@ stages: + diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index 8e920afed..7b84072ed 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -17,7 +17,7 @@ parameters: steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - bash: | @@ -102,3 +102,4 @@ steps: + diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index 55b27435b..7f08c0d9f 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -15,7 +15,7 @@ parameters: steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true - bash: | @@ -107,3 +107,4 @@ steps: + diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index bb4d7b08e..eddc043dc 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -38,7 +38,7 @@ parameters: steps: - checkout: self - path: Foundry-Local + path: s/Foundry-Local clean: true # Windows hosted agents don't have python on PATH by default — the launcher @@ -210,3 +210,4 @@ steps: + From 34f905370653b6799ac762c234d4e24762a30040 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 15:51:41 -0700 Subject: [PATCH 17/35] fix --- .pipelines/v2/templates/steps-build-linux.yml | 6 +++--- .../v2/templates/steps-build-windows.yml | 18 +++++++++--------- .pipelines/v2/templates/steps-pack-nuget.yml | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index 7b84072ed..7533f6bf1 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -56,7 +56,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -65,7 +65,7 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared @@ -87,7 +87,7 @@ steps: # side); test/example binaries are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' + src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index eddc043dc..91e2ce1c9 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -93,7 +93,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64)' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -107,7 +107,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64, WinML)' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -120,7 +120,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile)' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -134,7 +134,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile, WinML)' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -142,7 +142,7 @@ steps: - ${{ if and(eq(parameters.runTests, true), eq(parameters.arch, 'x64')) }}: - script: python build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.Repository.LocalPath)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)\test-data-shared @@ -164,8 +164,8 @@ steps: targetType: inline pwsh: true script: | - $binDir = '$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' - $linkDir = '$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' + $binDir = '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' + $linkDir = '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' $dst = '$(Build.ArtifactStagingDirectory)/native' New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -191,7 +191,7 @@ steps: - task: CopyFiles@2 displayName: 'Stage public headers' inputs: - SourceFolder: '$(Build.Repository.LocalPath)/sdk_v2/cpp/include' + SourceFolder: '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/include' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include' @@ -204,7 +204,7 @@ steps: - task: CopyFiles@2 displayName: 'Stage ms-gsl headers' inputs: - SourceFolder: '$(Build.Repository.LocalPath)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' + SourceFolder: '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include/gsl' diff --git a/.pipelines/v2/templates/steps-pack-nuget.yml b/.pipelines/v2/templates/steps-pack-nuget.yml index 5ae85d980..6eead5b2a 100644 --- a/.pipelines/v2/templates/steps-pack-nuget.yml +++ b/.pipelines/v2/templates/steps-pack-nuget.yml @@ -60,7 +60,7 @@ steps: $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Build.Repository.LocalPath)/sdk_v2/cpp/nuget/pack.py" ` + python "$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime" ` --ort_version "${{ parameters.ortVersion }}" ` @@ -89,7 +89,7 @@ steps: $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Build.Repository.LocalPath)/sdk_v2/cpp/nuget/pack.py" ` + python "$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime.WinML" ` --ort_version "${{ parameters.ortVersion }}" ` From 4be29f34d07465209cbe144acb99a8a24aeb8afb Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 15:52:19 -0700 Subject: [PATCH 18/35] fix fix --- .pipelines/v2/templates/steps-build-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index 7533f6bf1..9669139ce 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -87,7 +87,7 @@ steps: # side); test/example binaries are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' + src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" From 83dd48a548fc137965920febc2b3f19ce6a8b953 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 16:50:59 -0700 Subject: [PATCH 19/35] other platforms --- .pipelines/v2/templates/steps-build-linux.yml | 8 ++++---- .pipelines/v2/templates/steps-build-macos.yml | 8 ++++---- .../v2/templates/steps-build-windows.yml | 18 +++++++++--------- .pipelines/v2/templates/steps-pack-nuget.yml | 4 ++-- .../v2/templates/steps-prefetch-nuget.yml | 5 ++++- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index 9669139ce..8bfa24047 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -33,7 +33,7 @@ steps: winmlVersion: '' includeWinml: false includeOrtGpuLinux: true - shell: bash + shell: pwsh # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version instead of the cmake default. @@ -56,7 +56,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -65,7 +65,7 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared @@ -87,7 +87,7 @@ steps: # side); test/example binaries are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' + src='$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index 7f08c0d9f..b7635b830 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -41,7 +41,7 @@ steps: genaiVersion: ${{ parameters.genaiVersion }} winmlVersion: '' includeWinml: false - shell: bash + shell: pwsh # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version instead of the cmake default. @@ -64,7 +64,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -73,7 +73,7 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared @@ -92,7 +92,7 @@ steps: # are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' + src='$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 91e2ce1c9..fc26296a9 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -93,7 +93,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64)' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -107,7 +107,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64, WinML)' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -120,7 +120,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile)' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -134,7 +134,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile, WinML)' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -142,7 +142,7 @@ steps: - ${{ if and(eq(parameters.runTests, true), eq(parameters.arch, 'x64')) }}: - script: python build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp + workingDirectory: $(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)\test-data-shared @@ -164,8 +164,8 @@ steps: targetType: inline pwsh: true script: | - $binDir = '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' - $linkDir = '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' + $binDir = '$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' + $linkDir = '$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' $dst = '$(Build.ArtifactStagingDirectory)/native' New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -191,7 +191,7 @@ steps: - task: CopyFiles@2 displayName: 'Stage public headers' inputs: - SourceFolder: '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/include' + SourceFolder: '$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/include' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include' @@ -204,7 +204,7 @@ steps: - task: CopyFiles@2 displayName: 'Stage ms-gsl headers' inputs: - SourceFolder: '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' + SourceFolder: '$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include/gsl' diff --git a/.pipelines/v2/templates/steps-pack-nuget.yml b/.pipelines/v2/templates/steps-pack-nuget.yml index 6eead5b2a..2c439f791 100644 --- a/.pipelines/v2/templates/steps-pack-nuget.yml +++ b/.pipelines/v2/templates/steps-pack-nuget.yml @@ -60,7 +60,7 @@ steps: $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` + python "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime" ` --ort_version "${{ parameters.ortVersion }}" ` @@ -89,7 +89,7 @@ steps: $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` + python "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime.WinML" ` --ort_version "${{ parameters.ortVersion }}" ` diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 5e0410723..3be338d8f 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -32,6 +32,9 @@ parameters: steps: +- task: NuGetToolInstaller@1 + displayName: 'Install NuGet' + # Fail fast if the pipeline-pinned versions drift from the cmake source of # truth in sdk_v2/deps_versions.json. - task: PowerShell@2 @@ -41,7 +44,7 @@ steps: pwsh: true script: | $ErrorActionPreference = 'Stop' - $depsFile = Join-Path "$(Build.SourcesDirectory)/Foundry-Local" "sdk_v2/deps_versions.json" + $depsFile = Join-Path "$(Pipeline.Workspace)/s/Foundry-Local" "sdk_v2/deps_versions.json" if (-not (Test-Path $depsFile)) { throw "deps_versions.json not found at $depsFile" } From 5f99b222f3020e35c0791004afa54726a760ca99 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 17:20:10 -0700 Subject: [PATCH 20/35] linux --- .pipelines/v2/templates/steps-build-linux.yml | 2 +- .../v2/templates/steps-prefetch-nuget.yml | 33 +++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index 8bfa24047..deee978e6 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -33,7 +33,7 @@ steps: winmlVersion: '' includeWinml: false includeOrtGpuLinux: true - shell: pwsh + shell: bash # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version instead of the cmake default. diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 3be338d8f..2fd4503e0 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -10,7 +10,7 @@ # winmlVersion – Microsoft.Windows.AI.MachineLearning version (Windows only) # includeWinml – Download WinML and emit WINML_EP_CATALOG_FETCH_URL # includeOrtGpuLinux – Also download Microsoft.ML.OnnxRuntime.Gpu.Linux (Linux only) -# shell – 'pwsh' (Windows/macOS) or 'bash' (Linux) +# shell – 'pwsh' (Windows/macOS) or 'bash' (Linux only) parameters: - name: ortVersion @@ -184,9 +184,20 @@ steps: cacheDir="$(Build.BinariesDirectory)/nuget_packages" mkdir -p "$cacheDir" - # Use the AIFoundryLocal feed (with upstream to nuget.org) so restricted - # build agents do not need direct connectivity to www.nuget.org. - feed="https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/nuget/v2/package" + if [ "${{ parameters.includeOrtGpuLinux }}" != "True" ]; then + echo "ERROR: the bash prefetch branch is reserved for Linux native builds; use shell=pwsh for non-Linux platforms." >&2 + exit 1 + fi + + if [ -z "${SYSTEM_ACCESSTOKEN:-}" ]; then + echo "ERROR: SYSTEM_ACCESSTOKEN is not available for authenticated package download." >&2 + exit 1 + fi + + # Download package content via the Azure DevOps packaging REST API using + # the build OAuth token. This avoids both direct nuget.org access and the + # nuget.exe + mono dependency on hosted Linux agents. + feedBase="https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_apis/packaging/feeds/AIFoundryLocal_PublicPackages/nuget/packages" declare -a entries=( "genai:Microsoft.ML.OnnxRuntimeGenAI.Foundry:${{ parameters.genaiVersion }}" @@ -205,9 +216,17 @@ steps: for entry in "${entries[@]}"; do IFS=: read -r key id version <<< "$entry" out="$cacheDir/${key}.nupkg" - url="$feed/${id}/${version}" + if [ "$key" = "ort_gpu_linux" ]; then + lowerId=$(printf '%s' "$id" | tr '[:upper:]' '[:lower:]') + url="https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/nuget/v3/flat2/${lowerId}/${version}/${lowerId}.${version}.nupkg" + else + url="$feedBase/${id}/versions/${version}/content?api-version=7.1" + fi echo "Downloading $id $version" - curl -fSL -o "$out" "$url" + curl -fSL \ + -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \ + -o "$out" \ + "$url" echo " -> $out ($(stat -c%s "$out" 2>/dev/null || stat -f%z "$out") bytes)" case "$key" in @@ -221,5 +240,7 @@ steps: echo "##vso[task.setvariable variable=cmakeFetchDefines]$joined" echo "cmakeFetchDefines = $joined" displayName: 'Pre-download NuGet packages' + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) From 814cf218d01e279b27c3396ff543a472d82f2476 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 24 Jun 2026 22:55:40 -0700 Subject: [PATCH 21/35] bug fixes --- .pipelines/v2/templates/steps-build-python.yml | 10 ++++++++++ .pipelines/v2/templates/steps-pack-nuget.yml | 16 ++++++++++++++-- .pipelines/v2/templates/steps-prefetch-nuget.yml | 16 ++++++---------- .pipelines/v2/templates/steps-test-python.yml | 9 +++++++++ 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index cf4f4b386..9aa00756f 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -152,12 +152,22 @@ steps: } } +- task: PipAuthenticate@1 + displayName: 'Authenticate pip with Azure Artifacts' + inputs: + artifactFeeds: 'AIFoundryLocal/AIFoundryLocal_PublicPackages' + - task: PowerShell@2 displayName: 'Install build tooling' inputs: targetType: inline pwsh: true script: | + # Use the Azure Artifacts feed as the sole package index for build tooling. + # This avoids implicit fetches from public PyPI on hosted agents. + python -m pip config set global.index-url https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/pypi/simple/ + python -m pip config unset global.extra-index-url + if ($LASTEXITCODE -ne 0) { Write-Host 'No existing extra-index-url configured; continuing.' } python -m pip install --upgrade pip python -m pip install --upgrade build setuptools wheel "cffi>=1.16" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/.pipelines/v2/templates/steps-pack-nuget.yml b/.pipelines/v2/templates/steps-pack-nuget.yml index 2c439f791..c0ba7dbc7 100644 --- a/.pipelines/v2/templates/steps-pack-nuget.yml +++ b/.pipelines/v2/templates/steps-pack-nuget.yml @@ -57,10 +57,16 @@ steps: $version = (Get-Content "$(Pipeline.Workspace)/version-info/sdkVersion.txt" -Raw).Trim() Write-Host "Packing version: $version" + $packScript = "$(Build.SourcesDirectory)/sdk_v2/cpp/nuget/pack.py" + if (-not (Test-Path $packScript)) { + throw "pack.py not found at expected path: $packScript" + } + Write-Host "Using pack script: $packScript" + $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` + python "$packScript" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime" ` --ort_version "${{ parameters.ortVersion }}" ` @@ -86,10 +92,16 @@ steps: $version = (Get-Content "$(Pipeline.Workspace)/version-info/sdkVersion.txt" -Raw).Trim() Write-Host "Packing version: $version" + $packScript = "$(Build.SourcesDirectory)/sdk_v2/cpp/nuget/pack.py" + if (-not (Test-Path $packScript)) { + throw "pack.py not found at expected path: $packScript" + } + Write-Host "Using pack script: $packScript" + $outDir = "$(Build.ArtifactStagingDirectory)/nuget" New-Item -ItemType Directory -Force -Path $outDir | Out-Null - python "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cpp/nuget/pack.py" ` + python "$packScript" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime.WinML" ` --ort_version "${{ parameters.ortVersion }}" ` diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 2fd4503e0..9b55993c9 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -194,10 +194,10 @@ steps: exit 1 fi - # Download package content via the Azure DevOps packaging REST API using - # the build OAuth token. This avoids both direct nuget.org access and the - # nuget.exe + mono dependency on hosted Linux agents. - feedBase="https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_apis/packaging/feeds/AIFoundryLocal_PublicPackages/nuget/packages" + # Download package content from the feed's V3 flat-container endpoint. + # This avoids direct nuget.org access and avoids nuget.exe + mono on + # hosted Linux agents. + flatBase="https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/nuget/v3/flat2" declare -a entries=( "genai:Microsoft.ML.OnnxRuntimeGenAI.Foundry:${{ parameters.genaiVersion }}" @@ -216,12 +216,8 @@ steps: for entry in "${entries[@]}"; do IFS=: read -r key id version <<< "$entry" out="$cacheDir/${key}.nupkg" - if [ "$key" = "ort_gpu_linux" ]; then - lowerId=$(printf '%s' "$id" | tr '[:upper:]' '[:lower:]') - url="https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/nuget/v3/flat2/${lowerId}/${version}/${lowerId}.${version}.nupkg" - else - url="$feedBase/${id}/versions/${version}/content?api-version=7.1" - fi + lowerId=$(printf '%s' "$id" | tr '[:upper:]' '[:lower:]') + url="$flatBase/${lowerId}/${version}/${lowerId}.${version}.nupkg" echo "Downloading $id $version" curl -fSL \ -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \ diff --git a/.pipelines/v2/templates/steps-test-python.yml b/.pipelines/v2/templates/steps-test-python.yml index e36fd085f..ebce922aa 100644 --- a/.pipelines/v2/templates/steps-test-python.yml +++ b/.pipelines/v2/templates/steps-test-python.yml @@ -50,6 +50,11 @@ steps: Write-Host "##vso[task.setvariable variable=venvPy]$venvPy" Write-Host "venv python: $venvPy" +- task: PipAuthenticate@1 + displayName: 'Authenticate pip with Azure Artifacts' + inputs: + artifactFeeds: 'AIFoundryLocal/AIFoundryLocal_PublicPackages' + - task: PowerShell@2 displayName: 'Install built wheel + test deps' inputs: @@ -68,6 +73,10 @@ steps: $wheel = $wheels[0].FullName Write-Host "Installing wheel: $wheel" + # Use the Azure Artifacts feed as the sole package index for test installs. + & "$(venvPy)" -m pip config set global.index-url https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/pypi/simple/ + & "$(venvPy)" -m pip config unset global.extra-index-url + if ($LASTEXITCODE -ne 0) { Write-Host 'No existing extra-index-url configured; continuing.' } & "$(venvPy)" -m pip install --upgrade pip & "$(venvPy)" -m pip install $wheel if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } From 27d0241998bc9b6e93e71df3b2fe91969ee424cf Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 25 Jun 2026 00:24:12 -0700 Subject: [PATCH 22/35] bugs --- .pipelines/v2/templates/steps-build-js.yml | 22 +++++++++++++++ .pipelines/v2/templates/steps-pack-js.yml | 26 +++++++++++++++++ .pipelines/v2/templates/steps-test-cs.yml | 6 ++-- .pipelines/v2/templates/steps-test-js.yml | 28 +++++++++++++++++++ .pipelines/v2/templates/steps-test-python.yml | 2 +- 5 files changed, 81 insertions(+), 3 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-js.yml b/.pipelines/v2/templates/steps-build-js.yml index 468b806c0..83249625e 100644 --- a/.pipelines/v2/templates/steps-build-js.yml +++ b/.pipelines/v2/templates/steps-build-js.yml @@ -51,6 +51,24 @@ steps: inputs: versionSpec: '20.x' +- task: PowerShell@2 + displayName: 'Configure npm registry (AIFoundryLocal_PublicPackages)' + inputs: + targetType: inline + pwsh: true + script: | + $npmrc = "$(Agent.TempDirectory)/foundrylocal-$(System.JobId).npmrc" + $registry = 'https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/npm/registry/' + Set-Content -Path $npmrc -Value "registry=$registry`nalways-auth=true" -Encoding UTF8 + Write-Host "##vso[task.setvariable variable=npmUserConfig]$npmrc" + Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$npmrc" + Write-Host "npm userconfig: $npmrc" + +- task: npmAuthenticate@0 + displayName: 'Authenticate npm with Azure Artifacts' + inputs: + workingFile: '$(npmUserConfig)' + # Map ADO RID -> Node-style platform-arch key used inside the npm tarball # (prebuilds/-/) so downstream consumers find the addon under # the directory matching `${process.platform}-${process.arch}` at runtime. @@ -87,6 +105,8 @@ steps: command: custom workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' customCommand: 'ci --no-audit --no-fund --ignore-scripts' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' # binding.gyp resolves the foundry_local lib + gsl/public include dirs # via FOUNDRY_LOCAL_LIB_DIR and FOUNDRY_LOCAL_INCLUDE_DIR when set. The @@ -103,6 +123,7 @@ steps: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build Node-API addon' env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' FOUNDRY_LOCAL_LIB_DIR: '${{ parameters.nativeArtifactDir }}' FOUNDRY_LOCAL_INCLUDE_DIR: '${{ parameters.includeArtifactDir }}' # Force the copy_addon_to_prebuilds destination to the target-arch dir. @@ -118,6 +139,7 @@ steps: npx --no-install node-gyp rebuild displayName: 'Build Node-API addon' env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' FOUNDRY_LOCAL_LIB_DIR: '${{ parameters.nativeArtifactDir }}' FOUNDRY_LOCAL_INCLUDE_DIR: '${{ parameters.includeArtifactDir }}' FOUNDRY_LOCAL_PREBUILD_DIR: '$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds/$(prebuildDir)' diff --git a/.pipelines/v2/templates/steps-pack-js.yml b/.pipelines/v2/templates/steps-pack-js.yml index 338eb9bae..31056cf48 100644 --- a/.pipelines/v2/templates/steps-pack-js.yml +++ b/.pipelines/v2/templates/steps-pack-js.yml @@ -27,6 +27,24 @@ steps: inputs: versionSpec: '20.x' +- task: PowerShell@2 + displayName: 'Configure npm registry (AIFoundryLocal_PublicPackages)' + inputs: + targetType: inline + pwsh: true + script: | + $npmrc = "$(Agent.TempDirectory)/foundrylocal-$(System.JobId).npmrc" + $registry = 'https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/npm/registry/' + Set-Content -Path $npmrc -Value "registry=$registry`nalways-auth=true" -Encoding UTF8 + Write-Host "##vso[task.setvariable variable=npmUserConfig]$npmrc" + Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$npmrc" + Write-Host "npm userconfig: $npmrc" + +- task: npmAuthenticate@0 + displayName: 'Authenticate npm with Azure Artifacts' + inputs: + workingFile: '$(npmUserConfig)' + - pwsh: | $dst = "$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds" if (Test-Path $dst) { Remove-Item -Recurse -Force $dst } @@ -55,6 +73,8 @@ steps: command: custom workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' customCommand: 'ci --no-audit --no-fund --ignore-scripts' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - pwsh: | $version = (Get-Content "$(Pipeline.Workspace)/version-info/sdkVersion.txt" -Raw).Trim() @@ -63,12 +83,16 @@ steps: npm version $version --no-git-tag-version --allow-same-version if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Stamp package version' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - pwsh: | Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npm run build:ts if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build TypeScript' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - pwsh: | $dst = '${{ parameters.outputDir }}' @@ -78,5 +102,7 @@ steps: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Get-ChildItem $dst | ForEach-Object { Write-Host " $($_.Name) $($_.Length) bytes" } displayName: 'npm pack' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' diff --git a/.pipelines/v2/templates/steps-test-cs.yml b/.pipelines/v2/templates/steps-test-cs.yml index ed8bcf5aa..ddebe1c88 100644 --- a/.pipelines/v2/templates/steps-test-cs.yml +++ b/.pipelines/v2/templates/steps-test-cs.yml @@ -110,8 +110,10 @@ steps: pwsh: true script: | $proj = "$(Build.Repository.LocalPath)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" - $rid = dotnet msbuild $proj -getProperty:NETCoreSdkRuntimeIdentifier - if ($LASTEXITCODE -ne 0 -or -not $rid) { throw "Failed to determine RuntimeIdentifier" } + $dotnetInfo = (dotnet --info | Out-String) + $m = [regex]::Match($dotnetInfo, '(?m)^\s*RID:\s*(\S+)\s*$') + if (-not $m.Success) { throw "Failed to determine RuntimeIdentifier from dotnet --info" } + $rid = $m.Groups[1].Value.Trim() Write-Host "Restoring for RuntimeIdentifier: $rid" dotnet restore $proj ` diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index 37af15f6a..a08b23dfa 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -23,6 +23,24 @@ steps: inputs: versionSpec: '20.x' +- task: PowerShell@2 + displayName: 'Configure npm registry (AIFoundryLocal_PublicPackages)' + inputs: + targetType: inline + pwsh: true + script: | + $npmrc = "$(Agent.TempDirectory)/foundrylocal-$(System.JobId).npmrc" + $registry = 'https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/npm/registry/' + Set-Content -Path $npmrc -Value "registry=$registry`nalways-auth=true" -Encoding UTF8 + Write-Host "##vso[task.setvariable variable=npmUserConfig]$npmrc" + Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$npmrc" + Write-Host "npm userconfig: $npmrc" + +- task: npmAuthenticate@0 + displayName: 'Authenticate npm with Azure Artifacts' + inputs: + workingFile: '$(npmUserConfig)' + - ${{ if eq(parameters.rid, 'win-x64') }}: - pwsh: | $src = "${{ parameters.prebuildArtifactDir }}/prebuilds" @@ -53,12 +71,16 @@ steps: command: custom workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' customCommand: 'ci --no-audit --no-fund' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - pwsh: | Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" npm run build:ts if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build TypeScript' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - pwsh: | Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" @@ -66,6 +88,7 @@ steps: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Run vitest' env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' FOUNDRY_TEST_DATA_DIR: '${{ parameters.testDataSharedDir }}' - ${{ if or(eq(parameters.rid, 'linux-x64'), eq(parameters.rid, 'osx-arm64')) }}: @@ -74,12 +97,16 @@ steps: cd "$(Build.Repository.LocalPath)/sdk_v2/js" npm ci --no-audit --no-fund displayName: 'npm ci (runs install-native postinstall)' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - bash: | set -euo pipefail cd "$(Build.Repository.LocalPath)/sdk_v2/js" npm run build:ts displayName: 'Build TypeScript' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - bash: | set -euo pipefail @@ -87,6 +114,7 @@ steps: npx --no-install vitest run --reporter=verbose displayName: 'Run vitest' env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' FOUNDRY_TEST_DATA_DIR: '${{ parameters.testDataSharedDir }}' diff --git a/.pipelines/v2/templates/steps-test-python.yml b/.pipelines/v2/templates/steps-test-python.yml index ebce922aa..10c9c2c0b 100644 --- a/.pipelines/v2/templates/steps-test-python.yml +++ b/.pipelines/v2/templates/steps-test-python.yml @@ -89,7 +89,7 @@ steps: targetType: inline pwsh: true script: | - Push-Location "$(Build.Repository.LocalPath)/sdk_v2/python" + Push-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/python" try { # Override pythonpath = ["src"] from pyproject.toml so pytest # imports the installed wheel (which contains the compiled cffi From 9059081b1f242a1389466509e0a612d919a448e5 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 25 Jun 2026 10:01:47 -0700 Subject: [PATCH 23/35] even more bug fixes --- .pipelines/v2/templates/steps-build-js.yml | 12 +++-- .../v2/templates/steps-build-python.yml | 50 ++++++++++++++----- .pipelines/v2/templates/steps-pack-js.yml | 2 +- .pipelines/v2/templates/steps-test-cs.yml | 6 +-- .pipelines/v2/templates/steps-test-js.yml | 20 ++++---- 5 files changed, 61 insertions(+), 29 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-js.yml b/.pipelines/v2/templates/steps-build-js.yml index 83249625e..a17c9f1a8 100644 --- a/.pipelines/v2/templates/steps-build-js.yml +++ b/.pipelines/v2/templates/steps-build-js.yml @@ -104,7 +104,7 @@ steps: inputs: command: custom workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' - customCommand: 'ci --no-audit --no-fund --ignore-scripts' + customCommand: 'ci --no-audit --no-fund --ignore-scripts --include=dev' env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' @@ -119,7 +119,9 @@ steps: $args = if ($arch -eq 'native') { 'rebuild' } else { "rebuild --arch=$arch" } Write-Host "node-gyp $args" Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" - npx --no-install node-gyp $args.Split(' ') + $nodeGyp = Join-Path (Get-Location) 'node_modules/.bin/node-gyp.cmd' + if (-not (Test-Path $nodeGyp)) { throw "node-gyp not found at $nodeGyp" } + & $nodeGyp $args.Split(' ') if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build Node-API addon' env: @@ -136,7 +138,11 @@ steps: - bash: | set -euo pipefail cd "$(Build.Repository.LocalPath)/sdk_v2/js" - npx --no-install node-gyp rebuild + if [ ! -x ./node_modules/.bin/node-gyp ]; then + echo "node-gyp not found at ./node_modules/.bin/node-gyp" >&2 + exit 1 + fi + ./node_modules/.bin/node-gyp rebuild displayName: 'Build Node-API addon' env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index 9aa00756f..3ee63e0a0 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -37,12 +37,40 @@ parameters: steps: -- task: UsePythonVersion@0 - displayName: 'Use Python 3.12' - inputs: - versionSpec: '3.12' - addToPath: true - architecture: '${{ parameters.pythonArchitecture }}' +- ${{ if ne(parameters.rid, 'linux-x64') }}: + - task: UsePythonVersion@0 + displayName: 'Use Python 3.12' + inputs: + versionSpec: '3.12' + addToPath: true + architecture: '${{ parameters.pythonArchitecture }}' + +- ${{ if eq(parameters.rid, 'linux-x64') }}: + - task: PowerShell@2 + displayName: 'Use preinstalled system Python (Linux)' + inputs: + targetType: inline + pwsh: true + script: | + # Hosted Linux images may not have Python in Agent.ToolsDirectory, + # and UsePythonVersion then attempts a blocked GitHub download path. + # Use the preinstalled system python3 instead. + $pythonCmd = if (Get-Command python3.12 -ErrorAction SilentlyContinue) { 'python3.12' } else { 'python3' } + if (-not (Get-Command $pythonCmd -ErrorAction SilentlyContinue)) { + throw "Neither python3.12 nor python3 is available on PATH" + } + & $pythonCmd --version + $pythonPath = (& which $pythonCmd).Trim() + if (-not $pythonPath) { throw "Unable to resolve path for $pythonCmd" } + + $userBase = (& $pythonCmd -c "import site; print(site.USER_BASE)").Trim() + $userBin = Join-Path $userBase 'bin' + New-Item -ItemType Directory -Force -Path $userBin | Out-Null + & ln -sf $pythonPath (Join-Path $userBin 'python') + + Write-Host "System python: $pythonPath" + Write-Host "##vso[task.prependpath]$userBin" + Write-Host "##vso[task.setvariable variable=PIP_USER]1" - task: PowerShell@2 displayName: 'Set package version from pyVersion.txt' @@ -164,12 +192,10 @@ steps: pwsh: true script: | # Use the Azure Artifacts feed as the sole package index for build tooling. - # This avoids implicit fetches from public PyPI on hosted agents. - python -m pip config set global.index-url https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/pypi/simple/ - python -m pip config unset global.extra-index-url - if ($LASTEXITCODE -ne 0) { Write-Host 'No existing extra-index-url configured; continuing.' } - python -m pip install --upgrade pip - python -m pip install --upgrade build setuptools wheel "cffi>=1.16" + # Pass --index-url directly to avoid host-level pip config writes. + $indexUrl = 'https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/pypi/simple/' + python -m pip install --upgrade pip --index-url $indexUrl + python -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - ${{ if eq(parameters.targetArch, 'arm64') }}: diff --git a/.pipelines/v2/templates/steps-pack-js.yml b/.pipelines/v2/templates/steps-pack-js.yml index 31056cf48..6ef54f19d 100644 --- a/.pipelines/v2/templates/steps-pack-js.yml +++ b/.pipelines/v2/templates/steps-pack-js.yml @@ -72,7 +72,7 @@ steps: inputs: command: custom workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' - customCommand: 'ci --no-audit --no-fund --ignore-scripts' + customCommand: 'ci --no-audit --no-fund --ignore-scripts --include=dev' env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' diff --git a/.pipelines/v2/templates/steps-test-cs.yml b/.pipelines/v2/templates/steps-test-cs.yml index ddebe1c88..a39b4b8c6 100644 --- a/.pipelines/v2/templates/steps-test-cs.yml +++ b/.pipelines/v2/templates/steps-test-cs.yml @@ -109,7 +109,7 @@ steps: targetType: inline pwsh: true script: | - $proj = "$(Build.Repository.LocalPath)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" + $proj = "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" $dotnetInfo = (dotnet --info | Out-String) $m = [regex]::Match($dotnetInfo, '(?m)^\s*RID:\s*(\S+)\s*$') if (-not $m.Success) { throw "Failed to determine RuntimeIdentifier from dotnet --info" } @@ -143,7 +143,7 @@ steps: # The redirect file foundry_local.native.cfg is a local-dev override that, if # present, takes priority in DllLoader and would silently point the loader at # an arbitrary path on the agent. Sweep it out of every bin folder before tests. - $root = "$(Build.Repository.LocalPath)/sdk_v2/cs" + $root = "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cs" $stale = Get-ChildItem -Path $root -Recurse -Force -Filter 'foundry_local.native.cfg' -ErrorAction SilentlyContinue if ($stale) { Write-Host "Removing stale redirect files:" @@ -158,7 +158,7 @@ steps: targetType: inline pwsh: true script: | - $proj = "$(Build.Repository.LocalPath)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" + $proj = "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" # Test TFMs: # * net9.0 covers the .NET (Core) runtime test surface. diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index a08b23dfa..ec77fe60c 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -44,7 +44,7 @@ steps: - ${{ if eq(parameters.rid, 'win-x64') }}: - pwsh: | $src = "${{ parameters.prebuildArtifactDir }}/prebuilds" - $dst = "$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds" + $dst = "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js/prebuilds" if (-not (Test-Path $src)) { throw "Prebuild artifact missing: $src" } if (Test-Path $dst) { Remove-Item -Recurse -Force $dst } New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -56,7 +56,7 @@ steps: - bash: | set -euo pipefail src="${{ parameters.prebuildArtifactDir }}/prebuilds" - dst="$(Build.Repository.LocalPath)/sdk_v2/js/prebuilds" + dst="$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js/prebuilds" if [ ! -d "$src" ]; then echo "Prebuild artifact missing: $src" >&2; exit 1; fi rm -rf "$dst" mkdir -p "$dst" @@ -69,13 +69,13 @@ steps: displayName: 'npm ci (runs install-native postinstall)' inputs: command: custom - workingDir: '$(Build.Repository.LocalPath)/sdk_v2/js' - customCommand: 'ci --no-audit --no-fund' + workingDir: '$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js' + customCommand: 'ci --no-audit --no-fund --include=dev' env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - pwsh: | - Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" + Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" npm run build:ts if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build TypeScript' @@ -83,7 +83,7 @@ steps: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - pwsh: | - Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" + Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" npx --no-install vitest run --reporter=verbose if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Run vitest' @@ -94,15 +94,15 @@ steps: - ${{ if or(eq(parameters.rid, 'linux-x64'), eq(parameters.rid, 'osx-arm64')) }}: - bash: | set -euo pipefail - cd "$(Build.Repository.LocalPath)/sdk_v2/js" - npm ci --no-audit --no-fund + cd "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" + npm ci --no-audit --no-fund --include=dev displayName: 'npm ci (runs install-native postinstall)' env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - bash: | set -euo pipefail - cd "$(Build.Repository.LocalPath)/sdk_v2/js" + cd "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" npm run build:ts displayName: 'Build TypeScript' env: @@ -110,7 +110,7 @@ steps: - bash: | set -euo pipefail - cd "$(Build.Repository.LocalPath)/sdk_v2/js" + cd "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" npx --no-install vitest run --reporter=verbose displayName: 'Run vitest' env: From 51c5f07467fa2453175d454062ee0f92023644be Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 25 Jun 2026 11:35:16 -0700 Subject: [PATCH 24/35] fixes --- .pipelines/v2/templates/steps-build-js.yml | 22 ++++++++++++++----- .../v2/templates/steps-build-python.yml | 10 ++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-js.yml b/.pipelines/v2/templates/steps-build-js.yml index a17c9f1a8..7c695a98d 100644 --- a/.pipelines/v2/templates/steps-build-js.yml +++ b/.pipelines/v2/templates/steps-build-js.yml @@ -108,6 +108,18 @@ steps: env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' +- task: PowerShell@2 + displayName: 'Ensure node-gyp tooling is installed' + inputs: + targetType: inline + pwsh: true + script: | + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" + npm install --no-save --ignore-scripts --include=dev --no-audit --no-fund node-gyp node-api-headers + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' + # binding.gyp resolves the foundry_local lib + gsl/public include dirs # via FOUNDRY_LOCAL_LIB_DIR and FOUNDRY_LOCAL_INCLUDE_DIR when set. The # include artifact ships both `foundry_local/` and `gsl/` subdirectories; @@ -119,9 +131,9 @@ steps: $args = if ($arch -eq 'native') { 'rebuild' } else { "rebuild --arch=$arch" } Write-Host "node-gyp $args" Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" - $nodeGyp = Join-Path (Get-Location) 'node_modules/.bin/node-gyp.cmd' + $nodeGyp = Join-Path (Get-Location) 'node_modules/node-gyp/bin/node-gyp.js' if (-not (Test-Path $nodeGyp)) { throw "node-gyp not found at $nodeGyp" } - & $nodeGyp $args.Split(' ') + & node $nodeGyp $args.Split(' ') if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build Node-API addon' env: @@ -138,11 +150,11 @@ steps: - bash: | set -euo pipefail cd "$(Build.Repository.LocalPath)/sdk_v2/js" - if [ ! -x ./node_modules/.bin/node-gyp ]; then - echo "node-gyp not found at ./node_modules/.bin/node-gyp" >&2 + if [ ! -f ./node_modules/node-gyp/bin/node-gyp.js ]; then + echo "node-gyp not found at ./node_modules/node-gyp/bin/node-gyp.js" >&2 exit 1 fi - ./node_modules/.bin/node-gyp rebuild + node ./node_modules/node-gyp/bin/node-gyp.js rebuild displayName: 'Build Node-API addon' env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index 3ee63e0a0..06d7206ca 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -191,9 +191,13 @@ steps: targetType: inline pwsh: true script: | - # Use the Azure Artifacts feed as the sole package index for build tooling. - # Pass --index-url directly to avoid host-level pip config writes. - $indexUrl = 'https://pkgs.dev.azure.com/aiinfra/AIFoundryLocal/_packaging/AIFoundryLocal_PublicPackages/pypi/simple/' + # Require the authenticated pip URL injected by PipAuthenticate@1. + $indexUrl = $env:PIP_INDEX_URL + if (-not $indexUrl -and $env:PIP_EXTRA_INDEX_URL) { + $indexUrl = ($env:PIP_EXTRA_INDEX_URL -split '\s+')[0] + } + if (-not $indexUrl) { throw 'PipAuthenticate did not provide an authenticated pip index URL (PIP_INDEX_URL/PIP_EXTRA_INDEX_URL missing).' } + Write-Host "Using pip index: $indexUrl" python -m pip install --upgrade pip --index-url $indexUrl python -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } From 51eb0f962241bf6960b0964252d28e0cea8a4acb Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 25 Jun 2026 11:36:00 -0700 Subject: [PATCH 25/35] fmt --- .pipelines/v2/templates/steps-build-js.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-js.yml b/.pipelines/v2/templates/steps-build-js.yml index 7c695a98d..a4814c363 100644 --- a/.pipelines/v2/templates/steps-build-js.yml +++ b/.pipelines/v2/templates/steps-build-js.yml @@ -131,9 +131,9 @@ steps: $args = if ($arch -eq 'native') { 'rebuild' } else { "rebuild --arch=$arch" } Write-Host "node-gyp $args" Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" - $nodeGyp = Join-Path (Get-Location) 'node_modules/node-gyp/bin/node-gyp.js' + $nodeGyp = Join-Path (Get-Location) 'node_modules/node-gyp/bin/node-gyp.js' if (-not (Test-Path $nodeGyp)) { throw "node-gyp not found at $nodeGyp" } - & node $nodeGyp $args.Split(' ') + & node $nodeGyp $args.Split(' ') if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build Node-API addon' env: From ed69a445d146eb0a0f5eb91d8c379d02fce26276 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 25 Jun 2026 13:08:35 -0700 Subject: [PATCH 26/35] pls pls pls --- .../v2/templates/steps-build-python.yml | 34 ++++++++++++++++--- .pipelines/v2/templates/steps-pack-js.yml | 12 +++++++ .pipelines/v2/templates/steps-test-js.yml | 12 +++++++ 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index 06d7206ca..7acb95200 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -72,6 +72,31 @@ steps: Write-Host "##vso[task.prependpath]$userBin" Write-Host "##vso[task.setvariable variable=PIP_USER]1" + - task: PowerShell@2 + displayName: 'Create Linux build venv' + inputs: + targetType: inline + pwsh: true + script: | + $pythonCmd = if (Get-Command python3.12 -ErrorAction SilentlyContinue) { 'python3.12' } else { 'python3' } + $venvDir = "$(Agent.TempDirectory)/fl-python-build-venv-$(System.JobId)" + if (Test-Path $venvDir) { Remove-Item -Recurse -Force $venvDir } + & $pythonCmd -m venv $venvDir + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $venvPy = Join-Path $venvDir 'bin/python' + if (-not (Test-Path $venvPy)) { throw "venv python not found at $venvPy" } + Write-Host "Linux build venv: $venvDir" + Write-Host "##vso[task.setvariable variable=buildPythonExe]$venvPy" + +- ${{ if ne(parameters.rid, 'linux-x64') }}: + - task: PowerShell@2 + displayName: 'Set build Python executable' + inputs: + targetType: inline + pwsh: true + script: | + Write-Host "##vso[task.setvariable variable=buildPythonExe]python" + - task: PowerShell@2 displayName: 'Set package version from pyVersion.txt' inputs: @@ -194,12 +219,13 @@ steps: # Require the authenticated pip URL injected by PipAuthenticate@1. $indexUrl = $env:PIP_INDEX_URL if (-not $indexUrl -and $env:PIP_EXTRA_INDEX_URL) { - $indexUrl = ($env:PIP_EXTRA_INDEX_URL -split '\s+')[0] + $indexUrl = ($env:PIP_EXTRA_INDEX_URL -split '\s+')[0] } if (-not $indexUrl) { throw 'PipAuthenticate did not provide an authenticated pip index URL (PIP_INDEX_URL/PIP_EXTRA_INDEX_URL missing).' } Write-Host "Using pip index: $indexUrl" - python -m pip install --upgrade pip --index-url $indexUrl - python -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl + & "$(buildPythonExe)" -m pip install --upgrade pip --index-url $indexUrl + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & "$(buildPythonExe)" -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - ${{ if eq(parameters.targetArch, 'arm64') }}: @@ -368,7 +394,7 @@ steps: cmd /v:on /c $cmdLine if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } else { - python -m build --wheel --outdir $outDir @extraArgs + & "$(buildPythonExe)" -m build --wheel --outdir $outDir @extraArgs if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } } finally { diff --git a/.pipelines/v2/templates/steps-pack-js.yml b/.pipelines/v2/templates/steps-pack-js.yml index 6ef54f19d..5d28d1913 100644 --- a/.pipelines/v2/templates/steps-pack-js.yml +++ b/.pipelines/v2/templates/steps-pack-js.yml @@ -76,6 +76,18 @@ steps: env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' +- task: PowerShell@2 + displayName: 'Ensure TypeScript tooling is installed' + inputs: + targetType: inline + pwsh: true + script: | + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" + npm install --no-save --ignore-scripts --include=dev --no-audit --no-fund typescript + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' + - pwsh: | $version = (Get-Content "$(Pipeline.Workspace)/version-info/sdkVersion.txt" -Raw).Trim() Write-Host "Stamping JS package version: $version" diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index ec77fe60c..e4d1fd0dd 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -74,6 +74,18 @@ steps: env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' + - task: PowerShell@2 + displayName: 'Ensure TypeScript tooling is installed' + inputs: + targetType: inline + pwsh: true + script: | + Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" + npm install --no-save --ignore-scripts --include=dev --no-audit --no-fund typescript + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' + - pwsh: | Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" npm run build:ts From 4069a053da7daf3d94dfac0cdff1d95cb83d6196 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 25 Jun 2026 13:46:29 -0700 Subject: [PATCH 27/35] Revert "pls pls pls" This reverts commit ed69a445d146eb0a0f5eb91d8c379d02fce26276. --- .../v2/templates/steps-build-python.yml | 34 +++---------------- .pipelines/v2/templates/steps-pack-js.yml | 12 ------- .pipelines/v2/templates/steps-test-js.yml | 12 ------- 3 files changed, 4 insertions(+), 54 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index 7acb95200..06d7206ca 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -72,31 +72,6 @@ steps: Write-Host "##vso[task.prependpath]$userBin" Write-Host "##vso[task.setvariable variable=PIP_USER]1" - - task: PowerShell@2 - displayName: 'Create Linux build venv' - inputs: - targetType: inline - pwsh: true - script: | - $pythonCmd = if (Get-Command python3.12 -ErrorAction SilentlyContinue) { 'python3.12' } else { 'python3' } - $venvDir = "$(Agent.TempDirectory)/fl-python-build-venv-$(System.JobId)" - if (Test-Path $venvDir) { Remove-Item -Recurse -Force $venvDir } - & $pythonCmd -m venv $venvDir - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - $venvPy = Join-Path $venvDir 'bin/python' - if (-not (Test-Path $venvPy)) { throw "venv python not found at $venvPy" } - Write-Host "Linux build venv: $venvDir" - Write-Host "##vso[task.setvariable variable=buildPythonExe]$venvPy" - -- ${{ if ne(parameters.rid, 'linux-x64') }}: - - task: PowerShell@2 - displayName: 'Set build Python executable' - inputs: - targetType: inline - pwsh: true - script: | - Write-Host "##vso[task.setvariable variable=buildPythonExe]python" - - task: PowerShell@2 displayName: 'Set package version from pyVersion.txt' inputs: @@ -219,13 +194,12 @@ steps: # Require the authenticated pip URL injected by PipAuthenticate@1. $indexUrl = $env:PIP_INDEX_URL if (-not $indexUrl -and $env:PIP_EXTRA_INDEX_URL) { - $indexUrl = ($env:PIP_EXTRA_INDEX_URL -split '\s+')[0] + $indexUrl = ($env:PIP_EXTRA_INDEX_URL -split '\s+')[0] } if (-not $indexUrl) { throw 'PipAuthenticate did not provide an authenticated pip index URL (PIP_INDEX_URL/PIP_EXTRA_INDEX_URL missing).' } Write-Host "Using pip index: $indexUrl" - & "$(buildPythonExe)" -m pip install --upgrade pip --index-url $indexUrl - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - & "$(buildPythonExe)" -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl + python -m pip install --upgrade pip --index-url $indexUrl + python -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - ${{ if eq(parameters.targetArch, 'arm64') }}: @@ -394,7 +368,7 @@ steps: cmd /v:on /c $cmdLine if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } else { - & "$(buildPythonExe)" -m build --wheel --outdir $outDir @extraArgs + python -m build --wheel --outdir $outDir @extraArgs if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } } finally { diff --git a/.pipelines/v2/templates/steps-pack-js.yml b/.pipelines/v2/templates/steps-pack-js.yml index 5d28d1913..6ef54f19d 100644 --- a/.pipelines/v2/templates/steps-pack-js.yml +++ b/.pipelines/v2/templates/steps-pack-js.yml @@ -76,18 +76,6 @@ steps: env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' -- task: PowerShell@2 - displayName: 'Ensure TypeScript tooling is installed' - inputs: - targetType: inline - pwsh: true - script: | - Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" - npm install --no-save --ignore-scripts --include=dev --no-audit --no-fund typescript - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - env: - NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - - pwsh: | $version = (Get-Content "$(Pipeline.Workspace)/version-info/sdkVersion.txt" -Raw).Trim() Write-Host "Stamping JS package version: $version" diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index e4d1fd0dd..ec77fe60c 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -74,18 +74,6 @@ steps: env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - - task: PowerShell@2 - displayName: 'Ensure TypeScript tooling is installed' - inputs: - targetType: inline - pwsh: true - script: | - Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" - npm install --no-save --ignore-scripts --include=dev --no-audit --no-fund typescript - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - env: - NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' - - pwsh: | Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" npm run build:ts From 931df647bc08970869a128a5b8f3bafc34c7f441 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 25 Jun 2026 13:51:29 -0700 Subject: [PATCH 28/35] js --- .pipelines/v2/foundry-local-packaging.yml | 10 ++++++++-- .pipelines/v2/templates/steps-pack-js.yml | 8 ++++++++ .pipelines/v2/templates/steps-test-js.yml | 8 ++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index 00fd2e44f..b75e6e68e 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -7,8 +7,14 @@ # - JS SDK pr: -- main -- releases/* + branches: + include: + - main + - releases/* + paths: + include: + - .pipelines/v2/** + - sdk_v2/** name: $(Date:yyyyMMdd).$(Rev:r) diff --git a/.pipelines/v2/templates/steps-pack-js.yml b/.pipelines/v2/templates/steps-pack-js.yml index 6ef54f19d..51a2e2f1e 100644 --- a/.pipelines/v2/templates/steps-pack-js.yml +++ b/.pipelines/v2/templates/steps-pack-js.yml @@ -76,6 +76,14 @@ steps: env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' +- pwsh: | + Set-Location "$(Build.Repository.LocalPath)/sdk_v2/js" + npm install --no-save --ignore-scripts --include=dev --no-audit --no-fund typescript + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + displayName: 'Ensure TypeScript tooling is installed' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' + - pwsh: | $version = (Get-Content "$(Pipeline.Workspace)/version-info/sdkVersion.txt" -Raw).Trim() Write-Host "Stamping JS package version: $version" diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index ec77fe60c..c21e739e2 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -74,6 +74,14 @@ steps: env: NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' + - pwsh: | + Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" + npm install --no-save --ignore-scripts --include=dev --no-audit --no-fund typescript + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + displayName: 'Ensure TypeScript tooling is installed' + env: + NPM_CONFIG_USERCONFIG: '$(npmUserConfig)' + - pwsh: | Set-Location "$(Pipeline.Workspace)/s/Foundry-Local/sdk_v2/js" npm run build:ts From 1a8c2d52ea7e280e72f9a24b27f3d2d4d5504d10 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 12:51:07 -0700 Subject: [PATCH 29/35] python linux --- .../v2/templates/steps-build-python.yml | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-python.yml b/.pipelines/v2/templates/steps-build-python.yml index 06d7206ca..606da3404 100644 --- a/.pipelines/v2/templates/steps-build-python.yml +++ b/.pipelines/v2/templates/steps-build-python.yml @@ -62,15 +62,8 @@ steps: & $pythonCmd --version $pythonPath = (& which $pythonCmd).Trim() if (-not $pythonPath) { throw "Unable to resolve path for $pythonCmd" } - - $userBase = (& $pythonCmd -c "import site; print(site.USER_BASE)").Trim() - $userBin = Join-Path $userBase 'bin' - New-Item -ItemType Directory -Force -Path $userBin | Out-Null - & ln -sf $pythonPath (Join-Path $userBin 'python') - Write-Host "System python: $pythonPath" - Write-Host "##vso[task.prependpath]$userBin" - Write-Host "##vso[task.setvariable variable=PIP_USER]1" + Write-Host "##vso[task.setvariable variable=buildPythonExe]$pythonPath" - task: PowerShell@2 displayName: 'Set package version from pyVersion.txt' @@ -180,6 +173,28 @@ steps: } } +- ${{ if eq(parameters.rid, 'linux-x64') }}: + - task: PowerShell@2 + displayName: 'Create Linux build venv' + inputs: + targetType: inline + pwsh: true + script: | + $basePython = "$(buildPythonExe)" + if (-not $basePython) { throw "buildPythonExe is not set" } + + $venvDir = "$(Pipeline.Workspace)/.venv-python-build" + if (Test-Path $venvDir) { Remove-Item -Recurse -Force $venvDir } + + & $basePython -m venv $venvDir + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + $venvPython = Join-Path $venvDir 'bin/python' + if (-not (Test-Path $venvPython)) { throw "Venv python not found at $venvPython" } + + & $venvPython --version + Write-Host "##vso[task.setvariable variable=buildPythonExe]$venvPython" + - task: PipAuthenticate@1 displayName: 'Authenticate pip with Azure Artifacts' inputs: @@ -198,8 +213,12 @@ steps: } if (-not $indexUrl) { throw 'PipAuthenticate did not provide an authenticated pip index URL (PIP_INDEX_URL/PIP_EXTRA_INDEX_URL missing).' } Write-Host "Using pip index: $indexUrl" - python -m pip install --upgrade pip --index-url $indexUrl - python -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl + $pythonExe = if ('${{ parameters.rid }}' -eq 'linux-x64') { '$(buildPythonExe)' } else { 'python' } + if (-not $pythonExe) { throw 'Python executable is not set.' } + + & $pythonExe -m pip install --upgrade pip --index-url $indexUrl + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & $pythonExe -m pip install --upgrade build setuptools wheel "cffi>=1.16" --index-url $indexUrl if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - ${{ if eq(parameters.targetArch, 'arm64') }}: @@ -368,7 +387,9 @@ steps: cmd /v:on /c $cmdLine if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } else { - python -m build --wheel --outdir $outDir @extraArgs + $pythonExe = if ('${{ parameters.rid }}' -eq 'linux-x64') { '$(buildPythonExe)' } else { 'python' } + if (-not $pythonExe) { throw 'Python executable is not set.' } + & $pythonExe -m build --wheel --outdir $outDir @extraArgs if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } } finally { From dddf9b529752a50899720d6ecc9508d5744bd825 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 12:58:45 -0700 Subject: [PATCH 30/35] trig --- .pipelines/v2/foundry-local-packaging.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index b75e6e68e..f9d913662 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -6,6 +6,10 @@ # - Python SDK (base + WinML) # - JS SDK +# PR validation only. CI (push) is disabled to avoid duplicate runs when +# branch policy and YAML triggers both fire for the same commit. +trigger: none + pr: branches: include: From ab88297dc0b441daa17171f98fe0c632fd8c764f Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 13:13:06 -0700 Subject: [PATCH 31/35] test --- .pipelines/v2/foundry-local-packaging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index f9d913662..4812357cf 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -8,7 +8,7 @@ # PR validation only. CI (push) is disabled to avoid duplicate runs when # branch policy and YAML triggers both fire for the same commit. -trigger: none +trigger: none pr: branches: From a63cefb604b4d51da9c5d706d50f40d92e8544e1 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 13:28:30 -0700 Subject: [PATCH 32/35] Revert "test" This reverts commit ab88297dc0b441daa17171f98fe0c632fd8c764f. --- .pipelines/v2/foundry-local-packaging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index 4812357cf..f9d913662 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -8,7 +8,7 @@ # PR validation only. CI (push) is disabled to avoid duplicate runs when # branch policy and YAML triggers both fire for the same commit. -trigger: none +trigger: none pr: branches: From 095ac0d12962cd021fee89a4500d6b07a89fce52 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 13:28:36 -0700 Subject: [PATCH 33/35] Revert "trig" This reverts commit dddf9b529752a50899720d6ecc9508d5744bd825. --- .pipelines/v2/foundry-local-packaging.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index f9d913662..b75e6e68e 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -6,10 +6,6 @@ # - Python SDK (base + WinML) # - JS SDK -# PR validation only. CI (push) is disabled to avoid duplicate runs when -# branch policy and YAML triggers both fire for the same commit. -trigger: none - pr: branches: include: From d557643bf993ccab4bfc86288c93b6e397f6acf9 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 13:29:03 -0700 Subject: [PATCH 34/35] v1 --- .pipelines/v1/foundry-local-packaging.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.pipelines/v1/foundry-local-packaging.yml b/.pipelines/v1/foundry-local-packaging.yml index 7c02f23f5..926460f99 100644 --- a/.pipelines/v1/foundry-local-packaging.yml +++ b/.pipelines/v1/foundry-local-packaging.yml @@ -19,9 +19,19 @@ # - main # - releases/* +# PR validation only. CI (push) is disabled to avoid duplicate runs when +# branch policy and YAML triggers both fire for the same commit. +trigger: none + pr: -- main -- releases/* + branches: + include: + - main + - releases/* + paths: + include: + - .pipelines/v1/** + - sdk/** name: $(Date:yyyyMMdd).$(Rev:r) From 743c7da49409972b4195ccf1c7ed2094845c9599 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 13:30:05 -0700 Subject: [PATCH 35/35] trig --- .pipelines/v2/foundry-local-packaging.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pipelines/v2/foundry-local-packaging.yml b/.pipelines/v2/foundry-local-packaging.yml index b75e6e68e..f9d913662 100644 --- a/.pipelines/v2/foundry-local-packaging.yml +++ b/.pipelines/v2/foundry-local-packaging.yml @@ -6,6 +6,10 @@ # - Python SDK (base + WinML) # - JS SDK +# PR validation only. CI (push) is disabled to avoid duplicate runs when +# branch policy and YAML triggers both fire for the same commit. +trigger: none + pr: branches: include: