Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PackageUpdateResource to receive bool to indicate if snupkg are enabled #6249

Merged
merged 9 commits into from
Feb 28, 2025

Conversation

jgonz120
Copy link
Contributor

@jgonz120 jgonz120 commented Jan 31, 2025

Bug

Fixes: NuGet/Home#11871

Description

SymbolPackageUpdateResource is currently only being used in PackageUpdateResource to determine if snupkg are enabled for symbol sources. Since the push command allows users to specify a SymbolSource, there may not be a SymbolPackageUpdateResource available. This created a new function which takes in "allowSnupkg" as a parameter instead of trying to determine if it's available based on whether or not SymbolPackageUpdateResource is null.

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.

@jgonz120 jgonz120 requested a review from a team as a code owner January 31, 2025 23:06
@jgonz120 jgonz120 marked this pull request as draft February 1, 2025 00:12
@jgonz120 jgonz120 changed the title Set symbolPackageUpdateResource when symbolSource is passed by param to nuget push Update PackageUpdateResource to receive bool to indicate if snupkg are enabled Feb 1, 2025
@jgonz120 jgonz120 marked this pull request as ready for review February 5, 2025 18:57
Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

Looks good, but we need tests.

I see you've crossed off the added tests part but there's no justification for missing tests.

https://github.com/NuGet/NuGet.Client/blob/dev/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs has some tests.

Ideally, we can consider adding these tests to dotnet nuget push instead.

The setup code should be very similar.

@jebriede jebriede marked this pull request as draft February 18, 2025 23:10
@jgonz120 jgonz120 marked this pull request as ready for review February 24, 2025 22:27
@jgonz120 jgonz120 force-pushed the dev-jgonz120-allowSnupkgWhenSymbolUrlSpecified branch from 445655c to 4f0fcc2 Compare February 24, 2025 22:29
Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

I had left some comments, but didn't click submit :D

@jgonz120 jgonz120 requested a review from nkolev92 February 26, 2025 22:08
martinrrm
martinrrm previously approved these changes Feb 27, 2025
Copy link
Contributor

@martinrrm martinrrm left a comment

Choose a reason for hiding this comment

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

lgtm but I'm not an expert on this area

@jgonz120 jgonz120 dismissed stale reviews from nkolev92 and martinrrm via 54ee12e February 28, 2025 18:05
martinrrm
martinrrm previously approved these changes Feb 28, 2025
@jgonz120 jgonz120 requested a review from Copilot February 28, 2025 18:17

Choose a reason for hiding this comment

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

PR Overview

This PR updates the PackageUpdateResource and associated push logic to accept an explicit boolean flag for enabling snupkg pushes, addressing the issue where SymbolPackageUpdateResource may not be available when using a SymbolSource.

  • Introduces a new PushAsync method and overloads to control snupkg support explicitly.
  • Adds new integration tests in PushCommandTest to validate push behaviors for packages and symbols under various configurations.
  • Modifies the setup of mock servers to return the proper push endpoint and updates variable naming in the PushRunner.

Reviewed Changes

File Description
test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs Adds tests to verify proper push behavior for packages and snupkgs, and updates the mock server endpoint setup.
src/NuGet.Core/NuGet.Commands/CommandRunners/PushRunner.cs Updates the push logic to use an explicit snupkg flag and introduces a variable naming inconsistency.
src/NuGet.Core/NuGet.Protocol/Resources/PackageUpdateResource.cs Refactors push methods to accept a bool for snupkg support and deprecates the obsolete overload.

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs:1091

  • Consider using a proper URL concatenation method (e.g. using UriBuilder or ensuring a trailing slash) to guarantee the returned URI is well-formed.
return server.Uri + "push";

src/NuGet.Core/NuGet.Commands/CommandRunners/PushRunner.cs:57

  • The variable name 'symbeSourceUri' appears to contain a typo; consider renaming it to 'symbolSourceUri' for clarity.
var symbeSourceUri = symbolSource;
@jgonz120 jgonz120 enabled auto-merge (squash) February 28, 2025 18:42
@jgonz120 jgonz120 merged commit eb1dcd4 into dev Feb 28, 2025
20 of 23 checks passed
@jgonz120 jgonz120 deleted the dev-jgonz120-allowSnupkgWhenSymbolUrlSpecified branch February 28, 2025 19:27
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.

[Bug]: dotnet nuget push symbols not working as expected
4 participants