Skip to content

Conversation

@mmitche
Copy link
Member

@mmitche mmitche commented Sep 29, 2025

A number of repos have started to use package source mapping. When we add dotnet* internal feeds, the package source mappings don't apply. For static feeds like that (as opposed to darc-*), it would sometimes be better if the repo just kept them in the NuGet.config at all times. This is clearer for the dev as well as easier to manage w.r.t. package source mappings. So this, PR introduces a new method of dealing with internal sources in the NuGet.config. If the source already exists in the config, and is one of the known feed (dotnetN-internal and dotnetN-internal-transport), but is just disabled, enable it.

In addition, the following other tweaks were made:

  • Rename private->internal
  • Remove 3.1 support
  • Improve logging a bit.

I think that darc* support for package source mappings should be covered by Maestro.

To double check:

A number of repos have started to use package source mapping. When we add dotnet* internal feeds, the package source mappings don't apply. For static feeds like that (as opposed to darc-*), it would sometimes be better if the repo just kept them in the NuGet.config at all times. This is clearer for the dev as well as easier to manage w.r.t. package source mappings. So this, PR introduces a new method of dealing with internal sources in the NuGet.config. If the source already exists in the config, and is one of the known feed (dotnetN-internal and dotnetN-internal-transport), but is just disabled, enable it.

In addition, the following other tweaks were made:
- Rename private->internal
- Remove 3.1 support
- Improve logging a bit.

I think that darc* support for package source mappings should be covered by Maestro.
@mmitche mmitche requested review from a team and ViktorHofer October 1, 2025 19:04
ViktorHofer
ViktorHofer previously approved these changes Oct 2, 2025
@mmitche mmitche disabled auto-merge October 8, 2025 16:20
@mmitche mmitche enabled auto-merge (squash) October 8, 2025 16:20
@ViktorHofer ViktorHofer requested a review from Copilot October 8, 2025 16:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates the SetupNugetSources scripts with new functionality to better handle internal package feeds and package source mappings. The core change is that instead of always adding new internal feeds, the scripts will now enable existing disabled internal feeds when found, making them more compatible with package source mapping configurations.

Key changes:

  • Introduced a new approach for handling disabled internal feeds by enabling them instead of adding duplicates
  • Renamed terminology from "private" to "internal" for consistency
  • Removed support for .NET 3.1 feeds

Reviewed Changes

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

File Description
eng/common/SetupNugetSources.sh Shell script updated with new feed enabling logic and internal terminology
eng/common/SetupNugetSources.ps1 PowerShell script updated with corresponding functionality and improved error handling
src/Microsoft.DotNet.SetupNugetSources.Tests/*.cs New comprehensive test suite covering various scenarios
Arcade.slnx Added the new test project to the solution

{
var relative = Path.GetRelativePath(sourceDir, file);
var destPath = Path.Combine(destinationDir, relative);
Directory.CreateDirectory(Path.GetDirectoryName(destPath)!);
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

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

The null-forgiving operator (!) is used without null checking. Consider using Path.GetDirectoryName(destPath) ?? string.Empty or add a null check before the Directory.CreateDirectory call.

Suggested change
Directory.CreateDirectory(Path.GetDirectoryName(destPath)!);
Directory.CreateDirectory(Path.GetDirectoryName(destPath) ?? string.Empty);

Copilot uses AI. Check for mistakes.
PackageSourceCredentialsTemplate="${TB}<packageSourceCredentials>${NL}${TB}</packageSourceCredentials>"

sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" $ConfigFile
Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile"
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

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

This PowerShell function call is incorrect in a shell script. It should use the shell equivalent function or proper shell error handling syntax.

Suggested change
Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile"
echo "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile" >&2

Copilot uses AI. Check for mistakes.
@mmitche mmitche merged commit 41dda26 into dotnet:main Oct 8, 2025
10 checks passed
@mmitche
Copy link
Member Author

mmitche commented Oct 9, 2025

/backport to release/10.0

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2025

Started backporting to release/10.0: https://github.com/dotnet/arcade/actions/runs/18377864292

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.

2 participants