-
Notifications
You must be signed in to change notification settings - Fork 252
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
Package Source Mapping: Difficulty using it on Azure DevOps CI because it ends up needing feed-
prefixes in the source mapping configuration.
#11406
Comments
Thanks for trying out our new feature @cheesi!
Feed availability does not affect package source mapping, so whether contoso is available or not, there will be no fallback to NuGet.org.
This really depends on the source mapping configuration. Best match should be the only source used. If you're seeing anything different, it's probably a bug.
Hopefully my answers above clarify the expectations. Do you still see a need for an exclude option? |
If that's the case, then no, I don't see a reason for an exclude feature.
Yeah it's the config from above (just changed to fit our pattern):
I attached the log file, as it quite big: source_mapping.log I can see two issues from this log file:
|
We are seeing this too, the workaround from @cheesi helped. I changed my packageSoruceMapping to something like this:
|
We also were affected by this behavior. We created the Adding prefix Rider 2021.3 EAP 9 works well with the |
Thanks for your comments folks. Checking right now. I'd be surprised if |
You are correct, there should be no lines for projects. I have created a separate issue to track this behavior. #11413
That's great analysis @cheesi! How is your config generated?
we need to figure out how the nuget.config was generate and how that feed was added there. Are you using some azure devops tasks to add sources? Apologies for potentially asking the same questions, but if I understand correctly, the only problems you're running into are on the CI? |
Making progress, seing that there's some magic happening in some azure pipeline tasks: https://github.com/microsoft/azure-pipelines-tasks/search?q=feed- If anyone can let me know which tasks they're using that are Nuget related that'd be great! |
Hey all, I have made some progress and figured out that Azure DevOps tasks rewrite the configs and add I have filled an issue: microsoft/azure-pipelines-tasks#15542 I'll try to find someone from that end to confirm, but looks like most of the DotnetCoreCLiV2 tasks are affected. |
feed-
prefixes in the source mapping configuration.
I have retitled the issue. I'd appreciate if any of you could confirm my observations and provide info about the NuGet related tasks you have on your CI. If it's at all an option, please trying adding the There's a chance that the whole |
@nkolev92 I can confirm we are using the We do not use any NuGet tasks during our CI. There was no need so far. On my dev machine, I wasn't required to add |
I second this.
Am 24.11.2021 21:38 schrieb SergGuy ***@***.***>:
@nkolev92<https://github.com/nkolev92> I can confirm we are using the ***@***.*** task on Azure DevOps. We are building a solution with only .NET6 projects.
We do not use any NuGet tasks during our CI. There was no need so far. dotnet cli worked just fine.
On my dev machine, I wasn't required to add feed- to the key to get packages from our private feed. All worked as it is in docs. But strangely with the feed- prefix also everything is working.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#11406 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACNPDCFT32UXAII2K4UPV5DUNVEKRANCNFSM5IR5EMMQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Thank you for the quick replies folks! I'll be updating this thread as we make progress with the AzureDevOps tasks, but given that it's the holidays here in the US, it'll likely take a few days. Regarding |
Hey, thanks for creating all the issues and renaming the current one - definitely makes sense. We are already using NuGetAuthenticate in our CI pipeline:
|
@cheesi |
Yes, I can confirm that. |
This won't work because the DotNetCoreCLI task handles authentication as well as re-implements dotnet client behavior. When using the _Authenticate tasks, they're intended to handle authentication and to be followed by a simple command line task to invoke the standard CLI client. Using the authenticate task and then the heavy weight DotNetCoreCLI@2 task is redundant. |
@magleaso But thanks for the feedback, I did a fast test and the restore indeed works without the |
That's the opposite of what I'd recommend. The Authenticate task is newer and less prone to bugs. I would recommend removing the DotNetCoreCLI task and replacing it with a command line task that invokes |
Okay then what is the purpose of DotNetCoreCLI in general, when it is recommended to use command line tasks instead? |
DotNetCoreCLI is an older task that handles authentication and client behavior. It has been subsumed by the authenticate task because the authenticate task allows you to directly use the dotnet clients that everyone else on the internet is using, so you don't have to deal with situations like the one above where there is a deviation in the behavior of the DotNetCoreCLI task from the standard dotnet client. |
I see. So switching to a command line task should solve the problem with the package source mapping, as described above? |
Yes |
Thank you very much for the help, we will try this out as soon as possible. |
I edited the main issue body to include the recommendation. We're working on updating the docs with this guidance as well. |
Just an update here. Thanks to your help we have confirmed the problem is related to the azure devops tasks, as noted in microsoft/azure-pipelines-tasks#15542. We're going to close the issue on NuGet side, as there is no action from this part of the tooling. In addition to that, we're going to add a docs clarification about the issues you may run into if you use these tasks. Issue: https://github.com/NuGet/docs.microsoft.com-nuget/issues/2610 and a PR in progress: NuGet/docs.microsoft.com-nuget#2611. |
Per NuGet/Home#11406 this causes issues where the feed gets renamed, breaking package source mappings.
Per NuGet/Home#11406 this causes issues where the feed gets renamed, breaking package source mappings.
@nkolev92 FYI I just ran into this today (2 and a half years later) and the azure devops bit isn't fixed yet, just FYI. :) |
Still an issue now. Specific to azure devops. I am using
|
@cliedeman Please don't use the restore task. Refer to microsoft/azure-pipelines-tasks#15542 (comment). Copying the suggestion here for others: Replace - task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: 'restore'
restoreArguments: '--nologo'
feedsToUse: 'config'
nugetConfigPath: 'Nuget.config'
verbosityRestore: 'Normal' with - task: NuGetAuthenticate@1
displayName: 'Authenticate with NuGet'
- task: PowerShell@2
displayName: 'dotnet restore'
inputs:
targetType: 'inline'
script: 'dotnet restore --nologo' |
I reverted to using the dotnet cli and its working now 🥴. |
Maintainer Edit
The Azure DevOps problems occur when the DotNetCoreCLI is used.
The recommendation is to stop using the DotNetCoreCLI task and use NuGetAuthenticate for authentication and then use a Command Line Task to invoke
dotnet
.See: #11406 (comment)
NuGet Product(s) Involved
NuGet.exe, dotnet.exe
The Elevator Pitch
We tried to adapt the new package source mapping feature today, and found one case which is missing.
If I understand it correctly, the main reason behind the source mapping is, to accidentally restore internal nuget packages from nuget.org (ofc not the whole reason, but for me at least the biggest part of the cake).
Let's try this test setup from your blog post:
This basically specifies, that everything can be resolved via nuget.org, but for Contoso.* contoso.com should be used. Fine. But based from the log, it is still parsed as
Package source mapping matches found for package ID 'PACKAGE' are: 'nuget.org,feed-orga-project'.
Based on the documentation, the closest match is used, therefore contoso.com should be used. But what happens, when contoso.com is not available (for whatever reason)? Will it then fall back to nuget.org? Definitely not the thing I would like to configure.
I guess it would be nice if there would be an exclude feature. Because I don't really care, if nuget packages are restored via nuget.org or an internal feed, but I would like to make sure, that internal packages can only be restored by the internal feed.
Or am I missing anything?
Additional Context and Details
No response
The text was updated successfully, but these errors were encountered: