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

Use NuGet.config for restore during package testing #53837

Closed
wants to merge 2 commits into from

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Jun 7, 2021

Fixes #53810

@ghost
Copy link

ghost commented Jun 7, 2021

Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #53810

Author: ericstj
Assignees: -
Labels:

area-Infrastructure-libraries

Milestone: -

@ghost ghost added this to In Progress in Infrastructure Backlog Jun 7, 2021
Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

LGTM assuming that's the right location and the file will be considered during restore.

https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-transport/nuget/v3/index.json;
$(LocalPackagesPath)
</RestoreSources>
<RestoreAdditionalProjectSources>$(LocalPackagesPath)</RestoreAdditionalProjectSources>
Copy link
Member

Choose a reason for hiding this comment

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

nit: why not replace the LocalPackagesPath property with RestoreAdditionalProjectSources?

Copy link
Member

Choose a reason for hiding this comment

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

I think LocalPackagesPath is easier to remember when running package tests locally?

Copy link
Member

@ViktorHofer ViktorHofer Jun 8, 2021

Choose a reason for hiding this comment

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

That property isn't supposed to be passed in by the user. It's already passed in and by default points to the artifacts packages dir:

<TestRestoreCommand>$(TestRestoreCommand) /p:LocalPackagesPath=$(ArtifactsPackagesDir)</TestRestoreCommand>

Copy link
Member

Choose a reason for hiding this comment

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

Good point. For some reason I thought it was for local testing, I forgot we generated the test restore command.

Copy link
Member Author

Choose a reason for hiding this comment

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

Specifying known properties as global properties can make them effectively readonly in the evaluation, which could break other props/targets which were trying to append to them. This was the case with RestoreSources previously. I'm inclined to keep these seperate since it's not the intent of this to specify all additional restore sources, only one that we want to add.

@@ -45,6 +45,9 @@
<TestSupportFiles Include="$(LibrariesProjectRoot)shims\netfxreference.props">
<DestinationFolder>$(TestToolsDir)</DestinationFolder>
</TestSupportFiles>
<TestSupportFiles Include="$(RepoRoot)NuGet.config">
<DestinationFolder>$(TestSupportDir)</DestinationFolder>
Copy link
Member

@ViktorHofer ViktorHofer Jun 8, 2021

Choose a reason for hiding this comment

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

Are you expecting this to be picked up by the test project as well or just by test.msbuild? The former would not see this file.

Copy link
Member Author

Choose a reason for hiding this comment

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

There appears to be no directory in common with Helix payload structure and local structure. If this is changed to $(TestDir) it produces the correct layout locally but that's not present in helix :/. I guess we only need it to be present in Helix since that's the only place where it wouldn't find it in directory root. (since artifacts is below).

I'm debating just removing nuget.config entirely. We actually don't need to hit any feeds except nuget.org. The only place we need an additional feed is

<PackageReference Include="runtime.native.System.IO.Ports" Version="$(runtimenativeSystemIOPortsVersion)" NoWarn="NU1605" />
but that could be done differently, using an offically released package.

Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Why not just put the NuGet.config into a central location and point to it during the restore? There is a switch available for that. I'm changing the layout slightly with #53439 so I would recommend to wait for that to go in (which hopefully will in 1-2h).

Copy link
Member Author

@ericstj ericstj Jun 9, 2021

Choose a reason for hiding this comment

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

Any thoughts on this NuGet.config being more than we need for package restore in testing?

We actually don't need to hit any feeds except nuget.org

In fact, we probably don't want our packages depending on things from the internal feeds.

Copy link
Member

Choose a reason for hiding this comment

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

Any thoughts on this NuGet.config being more than we need for package restore in testing?

Nope I think that's fine. We follow the same approach in the installer tests in the runtime repo (they copy the NuGet.config over and add to it).

In fact, we probably don't want our packages depending on things from the internal feeds.

That's right, but we don't reference any internal feeds from our NuGet.config.

@ericstj
Copy link
Member Author

ericstj commented Jun 9, 2021

Actually, if you remove Helix this PR is no longer needed, since NuGet.config will already be used. Closing this one.

@ericstj ericstj closed this Jun 9, 2021
Infrastructure Backlog automation moved this from In Progress to Done Jun 9, 2021
@ViktorHofer
Copy link
Member

@ericstj I folded your changes into #53905 as that simplifies where to put the NuGet.config (as we don't upload artifacts anymore).

@ViktorHofer
Copy link
Member

Oh you were couple seconds faster than me commenting :D

@ericstj
Copy link
Member Author

ericstj commented Jun 9, 2021

I had just reached your PR in my notifications inbox :)

@ghost ghost locked as resolved and limited conversation to collaborators Jul 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package testing shouldn't hard code restore sources
3 participants