-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
dotnet tool restore --interactive
fails to restore tools from Artifacts unless I UseDotNet@2 Core 3.1.300 via global.json
#13061
Comments
dotnet tool restore --interactive
fails to restore tools from Artifacts unless I target Core 3.1.300dotnet tool restore --interactive
fails to restore tools from Artifacts unless I UseDotNet@2 Core 3.1.300 via global.json
Hi @VictorioBerra , It seems the credential provider is failing. Could you please use the NuGet installer task to ensure that you are on the latest version of nuget? And also make sure to have the latest DotNet version. Additionally, could you try to follow the advice from this comment? |
@apluche Thanks for the super fast reply. I have tried with the NuGetToolInstaller task:
Looks like it pulled the latest, but same issue. The I then modified my tool install task to this: - task: CmdLine@2
displayName: 'Execute Cake Script'
inputs:
script: |
nuget locals http-cache -clear
setx NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20
setx NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20
dotnet tool restore --interactive
dotnet cake For reference,
|
You'll need to set the variables as environment variables in your pipeline rather than in your script. The issue I can see here is that the credentialprovider is failing to start. Please let me know if that helps, if not, I'll keep digging |
@apluche Success. YAMLsteps:
- task: NuGetToolInstaller@1
- task: NuGetAuthenticate@0
- task: CmdLine@2
displayName: 'Execute Cake Script'
inputs:
script: |
nuget locals http-cache -clear
dotnet tool restore --interactive
dotnet cake Would you change anything else in the above pipeline? |
I'm glad to hear that you are unblocked. You may no longer need the NuGetToolInstaller so you can probably remove it from the pipeline. I'm not 100% familiar with dotnet, however, so the pipeline may still need the tool installer. It's worth testing if you can remove it. There isn't anything else that I see in your pipeline. On another note, the script will always clear the cache before starting the restore. In operations where you restore large amounts of packages, this may slow you down. If having that cache clear doesn't impact your pipeline significantly, it is worth leaving in there. |
Sometimes dotnet goes to nuget under the hood (I think nuget is shipped with dotnet) so I just wanted to cover all of the possibilities. Glad to hear you were able to delete those lines without having the pipeline fail. If you need any other help, please let me know or create a new issue. If you do end up seeing another CredentialProvider.Microsoft\CredentialProvider.Microsoft issue, you can create an issue here: https://github.com/Microsoft/artifacts-credprovider/issues |
For all those that come after me: I will be posting this response on a few issues that I frequented when troubleshooting a similar issue. This is not strictly related to this particular issue but someone may find it useful in the end. In my case, we were having issues with intermittent packages not being restored from a nuget feed with a networking error, for example:
Multiple packages would fail, and the packages that failed would be different every time. We would also periodically see a We eventually figured out that these issues only seemed to be occurring when multiple builds were happening in parallel on Azure DevOps. This led me to believe that perhaps there was some kind of rate-limiting happening against the Azure Artifacts server, because the solution in question had ~70 projects to be restored, thus making a lot of network calls. I enabled caching of nuget packages to alleviate this, which seemed to solve the problem. Below is a template YAML that I have added for all build tasks in our pipeline, and this seems to work for us. steps:
- task: NuGetAuthenticate@0
displayName: "Authenticate with NuGet"
inputs:
forceReinstallCredentialProvider: true
- task: UseDotNet@2
displayName: Install .NET Core
inputs:
useGlobalJson: true
- task: Cache@2
displayName: Cache NuGet packages
inputs:
key: "nuget | $(Agent.OS) | **/global.json, **/*.csproj"
restoreKeys: "nuget | $(Agent.OS)"
path: $(NUGET_PACKAGES) Usage example: jobs:
- job: Compile
displayName: "⚙ Compile"
dependsOn: []
steps:
- template: setup-build-task.azure-pipelines.yml
- task: CmdLine@2
displayName: Restore, lint, and build
inputs:
script: "./build.cmd RestoreTools Restore Lint Compile --skip" Godspeed. I had a hell of a few days with this one. |
Note
Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo
For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
If you have an issue or request for the Azure Pipelines service, use developer community instead:
https://developercommunity.visualstudio.com/spaces/21/index.html )
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name: CmdLine or DotNetCoreCLI
list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
Environment
Server - Azure Pipelines?
Agent - Hosted :
Agent name: 'Hosted Agent'
Agent machine name: 'fv-az674'
Current agent version: '2.169.1'
Issue Description
Auth to artifact fails when restoring tools (and a normal dotnet restore too) unless I install a newer version of core. Did something get updated in Core 3.1.300 that fixes this?
NuGet.Config:
Pipeline that fails.
Pipeline that works (with a global.json using 3.1.300)
Task logs
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
Error logs
[Insert error from the logs here for a quick overview]
The text was updated successfully, but these errors were encountered: