Skip to content

Download version-pinned NuGet.config for MAUI workload install#5261

Merged
LoopedBard3 merged 1 commit into
mainfrom
matouskozak-versioned-nuget-config-download
Jul 15, 2026
Merged

Download version-pinned NuGet.config for MAUI workload install#5261
LoopedBard3 merged 1 commit into
mainfrom
matouskozak-versioned-nuget-config-download

Conversation

@matouskozak

@matouskozak matouskozak commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

Instead of downloading the latest NuGet.config from branch HEAD of upstream repos (dotnet/maui, dotnet/android, dotnet/macios), extract the commit SHA from the NuGet package .nuspec metadata and download from the exact commit that produced the workload package.

Problem

MauiNuGetConfigContext downloads NuGet.config files from upstream repos using branch HEAD. If the upstream repo has moved ahead since the workload package was published, the NuGet.config may reference feeds that don't match the packages being installed.

Solution

NuGet packages embed <repository type="git" url="..." commit="..." /> in their .nuspec metadata. We use this to:

  1. Query the NuGet feed for the latest manifest package per upstream repo (same feed used for workload install)
  2. Download the .nuspec from the NuGet flat container API
  3. Extract the exact commit SHA from the <repository> element
  4. Download NuGet.config from that commit instead of branch HEAD

New functions

  • _find_latest_manifest_package — shared filtering logic (extracted from install_latest_maui)
  • _get_nuget_flat_container_base — gets flat container URL from NuGet V3 service index
  • _get_commit_sha_from_nuspec — downloads .nuspec, parses <repository> element
  • _discover_repo_commits — orchestrates per-repo commit SHA discovery

Modified functions

  • _get_repo_nuget_config_url / download_repo_nuget_config — accept optional commit_sha parameter
  • MauiNuGetConfigContext.__enter__ — calls _discover_repo_commits before downloading configs
  • install_latest_maui — refactored to use shared _find_latest_manifest_package helper

Fallback

Any failure in commit discovery silently falls back to the current branch-HEAD behavior. All failures are logged as warnings, never fatal.

Validation

Tested on https://dev.azure.com/dnceng/internal/_build/results?buildId=3022990&view=results— commit SHAs are correctly discovered and used for NuGet.config downloads.

Copilot AI review requested due to automatic review settings July 14, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR makes MAUI workload installs more deterministic by pinning upstream NuGet.config downloads (maui/android/macios) to the exact git commit that produced the workload’s manifest package, instead of downloading configs from branch HEAD.

Changes:

  • Added NuGet feed probing to download a manifest package .nuspec and extract <repository commit="..."> for commit-pinned NuGet.config URLs.
  • Refactored “latest manifest package” selection into a shared helper and reused it for both workload install and commit discovery.
  • Updated MauiNuGetConfigContext to attempt commit discovery and fall back to branch HEAD behavior on failure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 13:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Comment thread src/scenarios/shared/mauisharedpython.py
Copilot AI review requested due to automatic review settings July 14, 2026 13:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 14:23
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch from fb8de5e to 0b1c22d Compare July 14, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 14:49
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch from 9fb5fb9 to bd2182e Compare July 14, 2026 14:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 15:39
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch from 7b51ead to bd2182e Compare July 14, 2026 15:39
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch from bd2182e to d3512b6 Compare July 14, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/scenarios/shared/mauisharedpython.py
Comment thread src/scenarios/shared/mauisharedpython.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 16:23
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch from d3512b6 to e9832d2 Compare July 14, 2026 16:23
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch from e9832d2 to 8ed039f Compare July 14, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/scenarios/shared/mauisharedpython.py
Comment thread src/scenarios/shared/mauisharedpython.py
Copilot AI review requested due to automatic review settings July 14, 2026 16:32
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch 2 times, most recently from 0412706 to 8acde7c Compare July 14, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/scenarios/shared/mauisharedpython.py
Comment thread src/scenarios/shared/mauisharedpython.py
LoopedBard3
LoopedBard3 previously approved these changes Jul 14, 2026
Comment thread src/scenarios/shared/mauisharedpython.py
Instead of downloading NuGet.config from branch HEAD of upstream repos
(dotnet/maui, dotnet/android, dotnet/macios), extract the commit SHA
from the NuGet package .nuspec metadata and download from the exact
commit that produced the workload package.

Also refactors install_latest_maui to use the shared
_find_latest_manifest_package helper, and caches resolved manifest
packages so they aren't re-queried during workload install.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0dd7300a-1024-4ddc-a780-d0a9e0eee1e1
Copilot AI review requested due to automatic review settings July 15, 2026 10:26
@matouskozak
matouskozak force-pushed the matouskozak-versioned-nuget-config-download branch from 8acde7c to ae893d6 Compare July 15, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread src/scenarios/shared/mauisharedpython.py
@kotlarmilos
kotlarmilos self-requested a review July 15, 2026 11:16
@LoopedBard3
LoopedBard3 merged commit 2b6d995 into main Jul 15, 2026
71 of 76 checks passed
@LoopedBard3
LoopedBard3 deleted the matouskozak-versioned-nuget-config-download branch July 15, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants