Skip to content

Conversation

@Nigusu-Allehu
Copy link
Member

@Nigusu-Allehu Nigusu-Allehu commented Oct 24, 2025

Bug

Fixes: NuGet/Home#14607

Description

This PR

TLDR

  • When --source is specified, the command now prioritizes the provided source(s) and skips package source mapping
  • When --source is not specified, the command reads sources from nuget.config and applies package source mapping to determine which source to use for each package.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@Nigusu-Allehu
Copy link
Member Author

Nigusu-Allehu commented Oct 24, 2025

I will mark this PR ready for review, once the following design spec NuGet/Home#14495 gets approved. Or will update the PR if there is design changes.

@Nigusu-Allehu Nigusu-Allehu self-assigned this Oct 24, 2025
@Nigusu-Allehu Nigusu-Allehu changed the title Add package source mapping to package download [Feature] Add package source mapping to package download Oct 24, 2025
@Nigusu-Allehu
Copy link
Member Author

Also waiting on #6804 to merge first

@Nigusu-Allehu Nigusu-Allehu force-pushed the dev-pacakge-download-psm branch from 52f9b05 to 9ae9541 Compare October 27, 2025 23:32
Base automatically changed from dev-nyenework-packagedownload to dev-feature-package-download October 28, 2025 00:58
@Nigusu-Allehu Nigusu-Allehu force-pushed the dev-pacakge-download-psm branch 3 times, most recently from cb7c906 to 00a03c1 Compare October 28, 2025 03:26
@Nigusu-Allehu Nigusu-Allehu force-pushed the dev-pacakge-download-psm branch from e160332 to 4bd63e6 Compare October 29, 2025 21:29
@Nigusu-Allehu Nigusu-Allehu marked this pull request as ready for review October 29, 2025 21:45
@Nigusu-Allehu Nigusu-Allehu requested a review from a team as a code owner October 29, 2025 21:45
@Nigusu-Allehu Nigusu-Allehu requested review from jebriede and martinrrm and removed request for a team October 29, 2025 21:45
@Nigusu-Allehu Nigusu-Allehu merged commit 2d404a2 into dev-feature-package-download Oct 31, 2025
16 of 17 checks passed
@Nigusu-Allehu Nigusu-Allehu deleted the dev-pacakge-download-psm branch October 31, 2025 19:59
@Nigusu-Allehu Nigusu-Allehu mentioned this pull request Oct 31, 2025
3 tasks
null!
};

// no --source, mapping -> B, allow insecure not enabled -> fail
Copy link
Contributor

Choose a reason for hiding this comment

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

We are missing a test with no --source, mapping -> A,B, B has latest -> retrieves the latest package from B.

/// applying package source mapping
/// validating HTTP usage only on the *effective* sources.
/// </summary>
private static bool TryGetRepositoriesForPackage(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm finding this method really hard to read/maintain. There's too many nested control statements and three different code paths for a return statement. One suggestion would be to factor the foreach statement out into its own helper function. Ideally, there should be a single return statement.

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.

5 participants