Code Monkey home page Code Monkey logo

Comments (13)

satbai avatar satbai commented on August 27, 2024 1

Hi @PeterJakubik, unfortunately that is the exact intermittent issue that I was referring to in my earlier message. To understand your scenario better, could you turn the variable system.debug to true and try again? This will hopefully provide us some more logs. Also would you mind attaching a screen shot of your build definition?

Are you filling your credentials in the restore task's "Credentials for feeds outside this account/collection" section correctly? I should have mentioned this in my first message but the NuGet build task will automatically populate the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS variable if the Azure Artifacts credential provider (V2) is being used and the "Credentials for feeds outside this account/collection" section is filled. With the old way of authenticating (currently, when not setting the build env vars to force-enable "V2", or using NuGet version lesser than 4.8.1), the task will not use VSS_NUGET_EXTERNAL_FEED_ENDPOINTS env var but will create a temp nuget.config with the credentials provided and call NuGet restore with the nuget.config with credentials. Did this not work for you? If you didn't try yet or if you have a reason not to, please try and remove the build variables that force-enable V2 cred provider and fill out the "Credentials for feeds outside this account/collection" section with the credentials you want to use.

We are still investigating the issue but please let me know if using the old credential provider worked for you.

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

We are currently investigating an intermittent issue with the Artifacts Credential Provider in the NuGet build tasks. Therefore, we default to the old way of authenticating which doesn't recognize this environment variable VSS_NUGET_EXTERNAL_FEED_ENDPOINTS. To force your build task to use the Artifacts Credential Provider in NuGet build tasks you need to set two more build variables: NuGet_ForceEnableCredentialProviderV2=true and NuGet.ForceEnableCredentialProvider=false.

from artifacts-credprovider.

PeterJakubik avatar PeterJakubik commented on August 27, 2024

Thank you, I tried it but got

2018-11-28T14:36:55.3167976Z [command]C:\hostedtoolcache\windows\NuGet\4.8.1\x64\nuget.exe restore D:\a\1\s\ForecastWeb.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\1\s\src\SomeWeb\NuGet.Config
2018-11-28T14:37:13.9054685Z NuGet Version: 4.8.1.5435
2018-11-28T14:37:13.9055281Z MSBuild auto-detection: using msbuild version '15.8.169.51996' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
2018-11-28T14:37:13.9055472Z MSBuild P2P timeout [ms]: 120000
2018-11-28T14:37:13.9055746Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\msbuild.exe "C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\tbvb5kt1.lv4.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Users\VssAdministrator\AppData\Local\Temp\NuGetScratch\tp03cbxu.0rc.nugetrestore.targets" /p:RestoreUseCustomAfterTargets="True" /p:RestoreTaskAssemblyFile="C:\hostedtoolcache\windows\NuGet\4.8.1\x64\nuget.exe" /p:RestoreSolutionDirectory="D:\a\1\s\\" /p:RestoreConfigFile="D:\a\1\s\src\ForecastWeb\NuGet.Config" /p:SolutionDir="D:\a\1\s\\" /p:SolutionName="ForecastWeb"
...
...
2018-11-28T14:37:13.9063495Z Using D:\a\_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.0.48\node_modules\nuget-task-common\NuGet\CredentialProviderV2\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe as a credential provider plugin.
2018-11-28T14:37:13.9063697Z Terminating plugin 'CredentialProvider.Microsoft' due to an unrecoverable fault:  NuGet.Protocol.Plugins.ProtocolException: A plugin protocol exception occurred. ---> NuGet.Protocol.Plugins.ProtocolException: The message type 'Cancel' is invalid at this time.
2018-11-28T14:37:13.9064016Z    at NuGet.Protocol.Plugins.OutboundRequestContext`1.HandleCancelResponse()
2018-11-28T14:37:13.9064271Z    at NuGet.Protocol.Plugins.MessageDispatcher.OnMessageReceived(Object sender, MessageEventArgs e)
2018-11-28T14:37:13.9064499Z    at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
2018-11-28T14:37:13.9064663Z    at NuGet.Protocol.Plugins.StandardOutputReceiver.OnLineRead(Object sender, LineReadEventArgs e)
2018-11-28T14:37:13.9064826Z    --- End of inner exception stack trace ---
2018-11-28T14:37:13.9064975Z Retrying 'FindPackagesByIdAsyncCore' for source 'https://nuget.telerik.com/nuget/FindPackagesById()?id='Microsoft.AspNetCore.CookiePolicy'&semVerLevel=2.0.0'.
2018-11-28T14:37:13.9065219Z A task was canceled.

I'm using following NuGet.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="Telerik" value="https://nuget.telerik.com/nuget/" />
  </packageSources>
</configuration>

and VSS_NUGET_EXTERNAL_FEED_ENDPOINTS with json

from artifacts-credprovider.

PeterJakubik avatar PeterJakubik commented on August 27, 2024

Hi @satbai
Thank you. When I set the "Credentials for feeds outside this account/collection" it works!

So my NuGet.config looks like this

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="Telerik" value="https://nuget.telerik.com/nuget/" />
  </packageSources>
</configuration>

I set Build variables NuGet.ForceEnableCredentialProvider, NuGet_ForceEnableCredentialProviderV2, VSS_NUGET_EXTERNAL_FEED_ENDPOINTS

Variable VSS_NUGET_EXTERNAL_FEED_ENDPOINTS

{
"endpointCredentials": [
{
"endpoint":"https://nuget.telerik.com/nuget/", 
"username":"[email protected]", 
"password":"secret password"}
]}

The same credentials must be set in build task in credentials provider
image

So the credentials must be set in VSS_NUGET_EXTERNAL_FEED_ENDPOINTS and once more the exact credentials in build credentials provider. Nice would be to set the credentials only once

from artifacts-credprovider.

PeterJakubik avatar PeterJakubik commented on August 27, 2024

Hi @satbai
Although it works, i'm still getting occasional authentication Problems from Azure

2018-11-29T10:41:16.3477604Z   GET https://nuget.telerik.com/nuget/FindPackagesById()?id='Telerik.Reporting.Services.AspNetCore'&semVerLevel=2.0.0
2018-11-29T10:41:16.3477733Z   GET https://nuget.telerik.com/nuget/FindPackagesById()?id='Telerik.UI.for.AspNet.Core'&semVerLevel=2.0.0
2018-11-29T10:41:16.3477894Z Using D:\a\_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.0.48\node_modules\nuget-task-common\NuGet\CredentialProviderV2\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe as a credential provider plugin.
2018-11-29T10:41:16.3478210Z Terminating plugin 'CredentialProvider.Microsoft' due to an unrecoverable fault:  NuGet.Protocol.Plugins.ProtocolException: A plugin protocol exception occurred. ---> NuGet.Protocol.Plugins.ProtocolException: The message type 'Cancel' is invalid at this time.
2018-11-29T10:41:16.3478368Z    at NuGet.Protocol.Plugins.OutboundRequestContext`1.HandleCancelResponse()
2018-11-29T10:41:16.3478493Z    at NuGet.Protocol.Plugins.MessageDispatcher.OnMessageReceived(Object sender, MessageEventArgs e)
2018-11-29T10:41:16.3478588Z    at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
2018-11-29T10:41:16.3478839Z    at NuGet.Protocol.Plugins.StandardOutputReceiver.OnLineRead(Object sender, LineReadEventArgs e)
2018-11-29T10:41:16.3478929Z    --- End of inner exception stack trace ---
2018-11-29T10:41:16.3479058Z Retrying 'FindPackagesByIdAsyncCore' for source 'https://nuget.telerik.com/nuget/FindPackagesById()?id='Telerik.Reporting.Services.AspNetCore'&semVerLevel=2.0.0'.
2018-11-29T10:41:16.3479168Z A task was canceled.

Any update on this intermittent issue?

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

When you use the "Credentials for feeds outside this account/collection" you shouldn't need to set the variable VSS_NUGET_EXTERNAL_FEED_ENDPOINTS at all. If the task uses the Artifacts Cred Provider, which in your case it does because of the build variables that force it, the task will populate the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS variable under the covers based on the credentials that you've set in the task.

We'll update this issue once we know more about the intermittent exception in the NuGet build tasks when using the Artifacts Credential Provider.

from artifacts-credprovider.

PeterJakubik avatar PeterJakubik commented on August 27, 2024

I tried removing VSS_NUGET_EXTERNAL_FEED_ENDPOINTS.
Started Build 5x and 5x got an error.

2018-11-30T09:15:14.2877565Z   GET https://nuget.telerik.com/nuget/FindPackagesById()?id='Telerik.UI.for.AspNet.Core'&semVerLevel=2.0.0
2018-11-30T09:15:14.2877710Z Using D:\a\_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.0.48\node_modules\nuget-task-common\NuGet\CredentialProviderV2\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe as a credential provider plugin.
2018-11-30T09:15:14.2878100Z Terminating plugin 'CredentialProvider.Microsoft' due to an unrecoverable fault:  NuGet.Protocol.Plugins.ProtocolException: A plugin protocol exception occurred. ---> NuGet.Protocol.Plugins.ProtocolException: The message type 'Cancel' is invalid at this time.
2018-11-30T09:15:14.2878255Z    at NuGet.Protocol.Plugins.OutboundRequestContext`1.HandleCancelResponse()
2018-11-30T09:15:14.2878369Z    at NuGet.Protocol.Plugins.MessageDispatcher.OnMessageReceived(Object sender, MessageEventArgs e)
2018-11-30T09:15:14.2878464Z    at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
2018-11-30T09:15:14.2878574Z    at NuGet.Protocol.Plugins.StandardOutputReceiver.OnLineRead(Object sender, LineReadEventArgs e)
2018-11-30T09:15:14.2878665Z    --- End of inner exception stack trace ---

I will test again when the exception in the NuGet build tasks is fixed.

from artifacts-credprovider.

infin8x avatar infin8x commented on August 27, 2024

@PeterJakubik were you able to get this resolved?

from artifacts-credprovider.

PeterJakubik avatar PeterJakubik commented on August 27, 2024

I removed VSS_NUGET_EXTERNAL_FEED_ENDPOINTS, NuGet.ForceEnableCredentialProvider, NuGet_ForceEnableCredentialProviderV2 Pipline Variables and now I have only Nuget credentials provider .
It seems to be working right now.

from artifacts-credprovider.

kzu avatar kzu commented on August 27, 2024

I still need to set VSS_NUGET_EXTERNAL_FEED_ENDPOINTS explicitly in order for this to work on Mac agents even after installing the latest credentials provider. Adding all the endpoints as nuget service connections didn't work. The same tokens specified in the envvar do work, however.

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

@kzu if you're using the NuGetCommandV2 task with nuget version 4.8 or greater, it should automatically use the version of the cred provider that gets installed with the task, so you shouldn't have to install it separately. In the task, if you're using feeds in your nuget.config, the task will use the PATs that you set in the task as service connections and behind the scenes will populate VSS_NUGET_EXTERNAL_FEED_ENDPOINTS for you without you having to set it manually.

Please make sure that the service connections that you set in the task are PATs and that you're using the External Azure DevOps Server type of service connection:
image

If you're still having issues after verifying the service connection and removing the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS variable, please set the system.debug build variable to true and share the failing logs and I can take a look.

from artifacts-credprovider.

kzu avatar kzu commented on August 27, 2024

we're using msbuild /t:restore, not the nuget task. Would that apply in that case too?

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

For cases that are not using the NuGetCommandV2 task, you have to set things up manually.

from artifacts-credprovider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.