microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[BUG]: DotNetCoreCLI@2 restore causes DotNetCoreCLI push to fail for github authenticated nuget feed #19355

Open willherring-eventpoint opened 11 months ago

willherring-eventpoint commented 11 months ago

New issue checklist

Task name

DotNetCoreCLI@2

Task version

2.221.0

Issue Description

Using the provided yaml to build/pack/push a .net 6 nuget package to an authenticated github feed is working as expected but when uncommenting the "Restore" task the "Push" starts to throw a 401.

Repro:

  1. Set up github authenticated nuget feed
  2. Add service connection for github feed
  3. Use provided yaml to try to push a test package
  4. Uncomment Restore step and re-try step 3

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

ubuntu-latest

Relevant log output

Pushing {packageName}.0.2.2-prerelease-0078.nupkg to 'https://nuget.pkg.github.com/{org}'...
  PUT https://nuget.pkg.github.com/{org}/
warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
  Unauthorized https://nuget.pkg.github.com/{org}/ 690ms
error: Response status code does not indicate success: 401 (Unauthorized).

Full task logs with system.debug enabled

2023-12-08T02:51:07.5876778Z ==============================================================================
2023-12-08T02:51:07.5876884Z Task         : .NET Core
2023-12-08T02:51:07.5876950Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2023-12-08T02:51:07.5877059Z Version      : 2.221.0
2023-12-08T02:51:07.5877114Z Author       : Microsoft Corporation
2023-12-08T02:51:07.5877176Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2023-12-08T02:51:07.5877283Z ==============================================================================
2023-12-08T02:51:07.6623676Z ##[debug]Using node path: /home/vsts/agents/3.230.2/externals/node16/bin/node
2023-12-08T02:51:07.7585331Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp
2023-12-08T02:51:07.7599722Z ##[debug]loading inputs and endpoints
2023-12-08T02:51:07.7607507Z ##[debug]loading INPUT_COMMAND
2023-12-08T02:51:07.7621061Z ##[debug]loading INPUT_PUBLISHWEBPROJECTS
2023-12-08T02:51:07.7626089Z ##[debug]loading INPUT_PUBLISHTESTRESULTS
2023-12-08T02:51:07.7630549Z ##[debug]loading INPUT_ZIPAFTERPUBLISH
2023-12-08T02:51:07.7635076Z ##[debug]loading INPUT_MODIFYOUTPUTPATH
2023-12-08T02:51:07.7639441Z ##[debug]loading INPUT_SELECTORCONFIG
2023-12-08T02:51:07.7643712Z ##[debug]loading INPUT_INCLUDENUGETORG
2023-12-08T02:51:07.7649595Z ##[debug]loading INPUT_NUGETCONFIGPATH
2023-12-08T02:51:07.7654203Z ##[debug]loading INPUT_NOCACHE
2023-12-08T02:51:07.7659661Z ##[debug]loading INPUT_VERBOSITYRESTORE
2023-12-08T02:51:07.7665232Z ##[debug]loading INPUT_SEARCHPATTERNPUSH
2023-12-08T02:51:07.7671342Z ##[debug]loading INPUT_NUGETFEEDTYPE
2023-12-08T02:51:07.7676889Z ##[debug]loading INPUT_PUBLISHPACKAGEMETADATA
2023-12-08T02:51:07.7681964Z ##[debug]loading INPUT_EXTERNALENDPOINT
2023-12-08T02:51:07.7686164Z ##[debug]loading INPUT_SEARCHPATTERNPACK
2023-12-08T02:51:07.7690266Z ##[debug]loading INPUT_CONFIGURATIONTOPACK
2023-12-08T02:51:07.7694361Z ##[debug]loading INPUT_OUTPUTDIR
2023-12-08T02:51:07.7698742Z ##[debug]loading INPUT_NOBUILD
2023-12-08T02:51:07.7701699Z ##[debug]loading INPUT_INCLUDESYMBOLS
2023-12-08T02:51:07.7704542Z ##[debug]loading INPUT_INCLUDESOURCE
2023-12-08T02:51:07.7708390Z ##[debug]loading INPUT_VERSIONINGSCHEME
2023-12-08T02:51:07.7711334Z ##[debug]loading INPUT_REQUESTEDMAJORVERSION
2023-12-08T02:51:07.7714177Z ##[debug]loading INPUT_REQUESTEDMINORVERSION
2023-12-08T02:51:07.7717191Z ##[debug]loading INPUT_REQUESTEDPATCHVERSION
2023-12-08T02:51:07.7720879Z ##[debug]loading INPUT_VERBOSITYPACK
2023-12-08T02:51:07.7723647Z ##[debug]loading INPUT_WORKINGDIRECTORY
2023-12-08T02:51:07.7726381Z ##[debug]loading ENDPOINT_AUTH_{endpoint_id}
2023-12-08T02:51:07.7729142Z ##[debug]loading ENDPOINT_AUTH_SCHEME_{endpoint_id}
2023-12-08T02:51:07.7732004Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_{endpoint_id}_USERNAME
2023-12-08T02:51:07.7734895Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_{endpoint_id}_PASSWORD
2023-12-08T02:51:07.7738622Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2023-12-08T02:51:07.7741470Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2023-12-08T02:51:07.7744232Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2023-12-08T02:51:07.7748948Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2023-12-08T02:51:07.7752728Z ##[debug]loaded 34
2023-12-08T02:51:07.7758498Z ##[debug]Agent.ProxyUrl=undefined
2023-12-08T02:51:07.7761409Z ##[debug]Agent.CAInfo=undefined
2023-12-08T02:51:07.7763248Z ##[debug]Agent.ClientCert=undefined
2023-12-08T02:51:07.7765089Z ##[debug]Agent.SkipCertValidation=undefined
2023-12-08T02:51:07.9739156Z ##[debug]command=push
2023-12-08T02:51:07.9742592Z ##[debug]projects=undefined
2023-12-08T02:51:07.9744581Z ##[debug]arguments=undefined
2023-12-08T02:51:07.9748246Z ##[debug]publishWebProjects=true
2023-12-08T02:51:07.9751312Z ##[debug]zipAfterPublish=true
2023-12-08T02:51:07.9754690Z ##[debug]workingDirectory=/home/vsts/work/1/s
2023-12-08T02:51:07.9759437Z ##[debug]check path : /home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.221.0/node_modules/azure-pipelines-tasks-packaging-common/module.json
2023-12-08T02:51:07.9764694Z ##[debug]adding resource file: /home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.221.0/node_modules/azure-pipelines-tasks-packaging-common/module.json
2023-12-08T02:51:07.9766839Z ##[debug]system.culture=en-US
2023-12-08T02:51:07.9778785Z ##[debug]check path : /home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.221.0/task.json
2023-12-08T02:51:07.9781324Z ##[debug]adding resource file: /home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.221.0/task.json
2023-12-08T02:51:07.9783312Z ##[debug]system.culture=en-US
2023-12-08T02:51:07.9801335Z ##[debug]Getting Packaging service access points
2023-12-08T02:51:07.9803543Z ##[debug]System.TeamFoundationCollectionUri=https://dev.azure.com/***/
2023-12-08T02:51:07.9805849Z ##[debug]System.ServerType=Hosted
2023-12-08T02:51:07.9808129Z ##[debug]Getting credentials for local feeds
2023-12-08T02:51:07.9812110Z ##[debug]SYSTEMVSSCONNECTION exists true
2023-12-08T02:51:07.9814081Z ##[debug]Got auth token
2023-12-08T02:51:07.9817518Z ##[debug]System.ServerType=Hosted
2023-12-08T02:51:07.9821380Z ##[debug]Agent.ProxyUrl=undefined
2023-12-08T02:51:07.9838271Z ##[debug]Created webApi client for https://dev.azure.com/***/; options: {"proxy":null,"allowRetries":true,"maxRetries":5,"ignoreSslError":false}
2023-12-08T02:51:07.9852529Z ##[debug]Getting URI for area ID B3BE7473-68EA-4A81-BFC7-9530BAAA19AD from https://dev.azure.com/***/
2023-12-08T02:51:08.1112355Z ##[debug]Found resource area with locationUrl: https://pkgs.dev.azure.com/***/
2023-12-08T02:51:08.1115601Z ##[debug]Found serviceUri: https://pkgs.dev.azure.com/***/
2023-12-08T02:51:08.1361249Z ##[debug]Getting credentials for local feeds
2023-12-08T02:51:08.1409642Z ##[debug]SYSTEMVSSCONNECTION exists true
2023-12-08T02:51:08.1409998Z ##[debug]Got auth token
2023-12-08T02:51:08.1410276Z ##[debug]Agent.ProxyUrl=undefined
2023-12-08T02:51:08.1410769Z ##[debug]Created webApi client for https://pkgs.dev.azure.com/***/; options: {"proxy":null,"allowRetries":true,"maxRetries":5,"ignoreSslError":false}
2023-12-08T02:51:08.1413503Z ##[debug]Acquiring Packaging endpoints...
2023-12-08T02:51:08.4700176Z ##[debug]Successfully acquired the connection data
2023-12-08T02:51:08.4700894Z ##[debug]Acquired location
2023-12-08T02:51:08.4702186Z ##[debug]{"PackagingUris":["https://dev.azure.com/***/","https://pkgs.dev.azure.com/***/","https://pkgsprodcus1.pkgs.visualstudio.com/","https://pkgs.dev.azure.com/***/","https://***.pkgs.visualstudio.com/","https://pkgs.dev.azure.com/***/"],"DefaultPackagingUri":"https://pkgs.dev.azure.com/***/"}
2023-12-08T02:51:08.4702922Z ##[debug]searchPatternPush=/home/vsts/work/1/a/**/*.nupkg;!/home/vsts/work/1/a/**/*.symbols.nupkg
2023-12-08T02:51:08.4706890Z ##[debug]system.defaultWorkingDirectory=/home/vsts/work/1/s
2023-12-08T02:51:08.4707703Z ##[debug]defaultRoot: '/home/vsts/work/1/s'
2023-12-08T02:51:08.4708664Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'undefined'
2023-12-08T02:51:08.4709155Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'undefined'
2023-12-08T02:51:08.4710025Z ##[debug]findOptions.followSymbolicLinks: 'undefined'
2023-12-08T02:51:08.4710508Z ##[debug]findOptions.skipMissingFiles: 'undefined'
2023-12-08T02:51:08.4711388Z ##[debug]matchOptions.debug: 'undefined'
2023-12-08T02:51:08.4711845Z ##[debug]matchOptions.nobrace: 'undefined'
2023-12-08T02:51:08.4712712Z ##[debug]matchOptions.noglobstar: 'undefined'
2023-12-08T02:51:08.4713178Z ##[debug]matchOptions.dot: 'undefined'
2023-12-08T02:51:08.4714006Z ##[debug]matchOptions.noext: 'undefined'
2023-12-08T02:51:08.4714466Z ##[debug]matchOptions.nocase: 'undefined'
2023-12-08T02:51:08.4715290Z ##[debug]matchOptions.nonull: 'undefined'
2023-12-08T02:51:08.4715741Z ##[debug]matchOptions.matchBase: 'undefined'
2023-12-08T02:51:08.4716639Z ##[debug]matchOptions.nocomment: 'undefined'
2023-12-08T02:51:08.4717091Z ##[debug]matchOptions.nonegate: 'undefined'
2023-12-08T02:51:08.4717917Z ##[debug]matchOptions.flipNegate: 'undefined'
2023-12-08T02:51:08.4718375Z ##[debug]pattern: '/home/vsts/work/1/a/**/*.nupkg'
2023-12-08T02:51:08.4719222Z ##[debug]expanding braces
2023-12-08T02:51:08.4725932Z ##[debug]findPath: '/home/vsts/work/1/a'
2023-12-08T02:51:08.4726395Z ##[debug]statOnly: 'false'
2023-12-08T02:51:08.4727365Z ##[debug]findPath: '/home/vsts/work/1/a'
2023-12-08T02:51:08.4727849Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'undefined'
2023-12-08T02:51:08.4728892Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'undefined'
2023-12-08T02:51:08.4729368Z ##[debug]findOptions.followSymbolicLinks: 'undefined'
2023-12-08T02:51:08.4730277Z ##[debug]findOptions.skipMissingFiles: 'undefined'
2023-12-08T02:51:08.4731979Z ##[debug]  /home/vsts/work/1/a (directory)
2023-12-08T02:51:08.4733548Z ##[debug]  /home/vsts/work/1/a/{packageName}.nupkg (file)
2023-12-08T02:51:08.4734041Z ##[debug]2 results
2023-12-08T02:51:08.4734858Z ##[debug]found 2 paths
2023-12-08T02:51:08.4735290Z ##[debug]applying include pattern
2023-12-08T02:51:08.4739321Z ##[debug]1 matches
2023-12-08T02:51:08.4739811Z ##[debug]pattern: '!/home/vsts/work/1/a/**/*.symbols.nupkg'
2023-12-08T02:51:08.4740695Z ##[debug]trimmed leading '!'. pattern: '/home/vsts/work/1/a/**/*.symbols.nupkg'
2023-12-08T02:51:08.4741158Z ##[debug]expanding braces
2023-12-08T02:51:08.4742041Z ##[debug]after ensurePatternRooted, pattern: '/home/vsts/work/1/a/**/*.symbols.nupkg'
2023-12-08T02:51:08.4742533Z ##[debug]applying exclude pattern
2023-12-08T02:51:08.4745042Z ##[debug]0 matches
2023-12-08T02:51:08.4745488Z ##[debug]1 final results
2023-12-08T02:51:08.4747894Z ##[debug]nuGetFeedType=external
2023-12-08T02:51:08.4749191Z ##[debug]SYSTEMVSSCONNECTION=https://dev.azure.com/***/
2023-12-08T02:51:08.4749858Z ##[debug]discovered URL prefixes: https://dev.azure.com/***/,https://pkgs.dev.azure.com/***/,https://pkgsprodcus1.pkgs.visualstudio.com/,https://pkgs.dev.azure.com/***/,https://***.pkgs.visualstudio.com/,https://pkgs.dev.azure.com/***/
2023-12-08T02:51:08.4750893Z ##[debug]DotNetCoreCLITask.ExtraUrlPrefixesForTesting=undefined
2023-12-08T02:51:08.4751362Z ##[debug]Getting credentials for local feeds
2023-12-08T02:51:08.4752255Z ##[debug]SYSTEMVSSCONNECTION exists true
2023-12-08T02:51:08.4752694Z ##[debug]Got auth token
2023-12-08T02:51:08.4753629Z ##[debug]Agent.BuildDirectory=/home/vsts/work/1
2023-12-08T02:51:08.4754073Z ##[debug]build.buildId=12961
2023-12-08T02:51:08.4755183Z ##[debug]testing directory '/home/vsts/work/1/NuGet_12961'
2023-12-08T02:51:08.4758997Z ##[debug]testing directory '/home/vsts/work/1'
2023-12-08T02:51:08.4759488Z ##[debug]mkdir '/home/vsts/work/1/NuGet_12961'
2023-12-08T02:51:08.4762992Z ##[debug]externalEndpoint={endpoint_id}
2023-12-08T02:51:08.4764799Z ##[debug]{endpoint_id}=https://nuget.pkg.github.com/***/index.json
2023-12-08T02:51:08.4766891Z ##[debug]{endpoint_id} exists true
2023-12-08T02:51:08.4768875Z ##[debug]{endpoint_id} auth scheme = UsernamePassword
2023-12-08T02:51:08.4769417Z ##[debug]adding password auth entry for feed https://nuget.pkg.github.com/***/index.json
2023-12-08T02:51:08.4771090Z ##[debug]Adding sources to nuget.config
2023-12-08T02:51:08.4778532Z ##[debug]Saving NuGet.config to a temporary config file.
2023-12-08T02:51:08.4794052Z ##[debug]Setting auth in the temp nuget.config
2023-12-08T02:51:08.4795045Z ##[debug]Saving NuGet.config to a temporary config file.
2023-12-08T02:51:08.4796719Z ##[debug]Getting sources from NuGet.config in this location: /home/vsts/work/1/NuGet_12961/nuget.config
2023-12-08T02:51:08.4802782Z ##[debug]considering source https://nuget.pkg.github.com/***/index.json. Internal: false
2023-12-08T02:51:08.4804224Z ##[debug]Setting auth for external source https://nuget.pkg.github.com/***/index.json
2023-12-08T02:51:08.4808304Z Using authentication information for the following URI: https://nuget.pkg.github.com/***/index.json
2023-12-08T02:51:08.4817523Z ##[debug]ValidAuthenticationTypes_httpsnugetpkggithubcom***indexjson=undefined
2023-12-08T02:51:08.4819860Z This task now configures NuGet to send these credentials using the Basic scheme
2023-12-08T02:51:08.4820083Z only. Most users will be unaffected by this change. If these are Windows domain
2023-12-08T02:51:08.4820296Z credentials and they have recently stopped working, try setting the build
2023-12-08T02:51:08.4820900Z variable ValidAuthenticationTypes_httpsnugetpkggithubcom***indexjson to the value 'negotiate,ntlm' (without quotes).
2023-12-08T02:51:08.4823506Z ##[debug]which 'dotnet'
2023-12-08T02:51:08.4829789Z ##[debug]found: '/usr/bin/dotnet'
2023-12-08T02:51:08.4831673Z ##[debug]which '/usr/bin/dotnet'
2023-12-08T02:51:08.4831958Z ##[debug]found: '/usr/bin/dotnet'
2023-12-08T02:51:08.4833295Z ##[debug]/usr/bin/dotnet arg: nuget
2023-12-08T02:51:08.4833588Z ##[debug]/usr/bin/dotnet arg: push
2023-12-08T02:51:08.4833922Z ##[debug]/usr/bin/dotnet arg: /home/vsts/work/1/a/{packageName}.nupkg
2023-12-08T02:51:08.4834248Z ##[debug]/usr/bin/dotnet arg: --source
2023-12-08T02:51:08.4834909Z ##[debug]/usr/bin/dotnet arg: https://nuget.pkg.github.com/***/index.json
2023-12-08T02:51:08.4835216Z ##[debug]/usr/bin/dotnet arg: --api-key
2023-12-08T02:51:08.4835506Z ##[debug]/usr/bin/dotnet arg: RequiredApiKey
2023-12-08T02:51:08.4836117Z ##[debug]agent.proxyurl=undefined
2023-12-08T02:51:08.4836401Z ##[debug]agent.proxyusername=undefined
2023-12-08T02:51:08.4836682Z ##[debug]agent.proxypassword=undefined
2023-12-08T02:51:08.4838316Z ##[debug]exec tool: /usr/bin/dotnet
2023-12-08T02:51:08.4838605Z ##[debug]arguments:
2023-12-08T02:51:08.4838865Z ##[debug]   nuget
2023-12-08T02:51:08.4839115Z ##[debug]   push
2023-12-08T02:51:08.4839797Z ##[debug]   /home/vsts/work/1/a/{packageName}.nupkg
2023-12-08T02:51:08.4840111Z ##[debug]   --source
2023-12-08T02:51:08.4840428Z ##[debug]   https://nuget.pkg.github.com/***/index.json
2023-12-08T02:51:08.4840711Z ##[debug]   --api-key
2023-12-08T02:51:08.4841286Z ##[debug]   RequiredApiKey
2023-12-08T02:51:08.4842096Z [command]/usr/bin/dotnet nuget push /home/vsts/work/1/a/{packageName}.nupkg --source https://nuget.pkg.github.com/***/index.json --api-key RequiredApiKey
2023-12-08T02:51:08.8422330Z Pushing {packageName}.nupkg to 'https://nuget.pkg.github.com/***'...
2023-12-08T02:51:08.8529753Z   PUT https://nuget.pkg.github.com/***/
2023-12-08T02:51:09.3805336Z warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
2023-12-08T02:51:09.9257000Z warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
2023-12-08T02:51:10.0019732Z warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
2023-12-08T02:51:10.0801417Z warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
2023-12-08T02:51:10.1758038Z warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
2023-12-08T02:51:10.1783582Z   Unauthorized https://nuget.pkg.github.com/***/ 902ms
2023-12-08T02:51:10.1826450Z error: Response status code does not indicate success: 401 (Unauthorized).
2023-12-08T02:51:10.1946076Z 
2023-12-08T02:51:10.1946427Z 
2023-12-08T02:51:10.1946996Z Usage: dotnet nuget push [arguments] [options]
2023-12-08T02:51:10.1947214Z 
2023-12-08T02:51:10.1947593Z Arguments:
2023-12-08T02:51:10.1948259Z   [root]  Specify the path to the package and your API key to push the package to the server.
2023-12-08T02:51:10.1948459Z 
2023-12-08T02:51:10.1948584Z Options:
2023-12-08T02:51:10.1948928Z   -h|--help                      Show help information
2023-12-08T02:51:10.1949219Z   --force-english-output         Forces the application to run using an invariant, English-based culture.
2023-12-08T02:51:10.1949603Z   -s|--source <source>           Package source (URL, UNC/folder path or package source name) to use. Defaults to DefaultPushSource if specified in NuGet.Config.
2023-12-08T02:51:10.1950148Z   -ss|--symbol-source <source>   Symbol server URL to use.
2023-12-08T02:51:10.1950468Z   -t|--timeout <timeout>         Timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes).
2023-12-08T02:51:10.1950721Z   -k|--api-key <apiKey>          The API key for the server.
2023-12-08T02:51:10.1950963Z   -sk|--symbol-api-key <apiKey>  The API key for the symbol server.
2023-12-08T02:51:10.1951282Z   -d|--disable-buffering         Disable buffering when pushing to an HTTP(S) server to decrease memory usage.
2023-12-08T02:51:10.1951583Z   -n|--no-symbols                If a symbols package exists, it will not be pushed to a symbols server.
2023-12-08T02:51:10.1951869Z   --no-service-endpoint          Does not append "api/v2/package" to the source URL.
2023-12-08T02:51:10.1952179Z   --interactive                  Allow the command to block and require manual action for operations like authentication.
2023-12-08T02:51:10.1952531Z   --skip-duplicate               If a package and version already exists, skip it and continue with the next package in the push, if any.
2023-12-08T02:51:10.1952656Z 
2023-12-08T02:51:10.2145766Z ##[debug]Exit code 1 received from tool '/usr/bin/dotnet'
2023-12-08T02:51:10.2501538Z ##[debug]STDIO streams have closed for tool '/usr/bin/dotnet'
2023-12-08T02:51:10.2516671Z ##[debug]rm -rf /home/vsts/work/1/NuGet_12961
2023-12-08T02:51:10.2517777Z ##[debug]removing directory
2023-12-08T02:51:10.2545605Z ##[error]Error: The process '/usr/bin/dotnet' failed with exit code 1
2023-12-08T02:51:10.2546070Z ##[debug]Processed: ##vso[task.issue type=error;]Error: The process '/usr/bin/dotnet' failed with exit code 1
2023-12-08T02:51:10.2546747Z ##[debug]task result: Failed
2023-12-08T02:51:10.2547662Z ##[error]Packages failed to publish
2023-12-08T02:51:10.2548061Z ##[debug]Processed: ##vso[task.issue type=error;]Packages failed to publish
2023-12-08T02:51:10.2548903Z ##[debug]Processed: ##vso[task.complete result=Failed;]Packages failed to publish
2023-12-08T02:51:10.2551689Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2023-12-08T02:51:10.2621422Z ##[section]Finishing: Push

Repro steps

trigger:
  - main

pool:
  vmImage: ubuntu-latest

variables:
  project: "testApp"
  system.debug: true

steps:
  - checkout: self
    fetchDepth: 0

  - task: NuGetToolInstaller@0
    displayName: 'Use NuGet 6.7.x'
    inputs:
      versionSpec: 6.7.x

  - task: NuGetAuthenticate@1
    displayName: Authenticate to GitHub
    inputs:
      nuGetServiceConnections: "githubpackagefeed"

  # - task: DotNetCoreCLI@2
  #   displayName: Restore
  #   inputs:
  #     command: "restore"
  #     projects: "**/$(project).csproj"
  #     selectOrConfig: "config"
  #     nugetConfigPath: "Nuget.Config"
  #     externalEndpoints: "githubpackagefeed"

  - task: DotNetCoreCLI@2
    displayName: Build
    inputs:
      command: "build"
      arguments: "--configuration $(buildConfiguration)"
      projects: "**/$(project).csproj"

  - task: DotNetCoreCLI@2
    displayName: Pack
    inputs:
      command: "pack"
      packagesToPack: "**/$(project).csproj"
      arguments: "-o $(Build.ArtifactStagingDirectory)"
      nobuild: true
      versioningScheme: "byEnvVar"
      versionEnvVar: "Build.BuildNumber"

  - task: DotNetCoreCLI@2
    displayName: Push
    inputs:
      command: "push"
      packagesToPush: "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg"
      nuGetFeedType: "external"
      externalEndPoint: "githubpackagefeed"
sjackson-ccdc commented 5 months ago

I'm also having this issue. It seems that even though we specify the externalEndPoint it still adds the --api-key RequiredApiKey flag causing it to fail. Would love a resoution to this.