Sitelet https://github.com/fsprojects/Paket/issues/2884
Skip to content

Unhandled exception when running 'paket config add-credentials' in Jenkins pipeline #2884

Description

@caveman-dick

Description

I have just discovered that trying to run 'paket config add-credentials' within a Jenkins pipeline fails due to trying to do a Console.ReadLine(). This returns null in the context of a Jenkins build and throws a System.NullReferenceException.

Repro steps

  1. Create a Jenkins pipeline that runs the following command:
paket.exe config add-credentials https://nuget-server-with-authentication.com/ --username **** --password **** 
  1. Run the pipeline

Expected behavior

The default authentication type of basic is taken and the command adds the authentication details.

Actual behavior

C:\jenkins\ws\7958e3d43a>..paket\paket.exe config add-credentials https://advancedcsg.jfrog.io/advancedcsg/api/nuget/nuget-snapshot-virtual --username **** --password ****
Paket version 5.120.1
Authentication type (basic|ntlm, default = basic): Performance:

  • Runtime: 857 milliseconds

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Paket.ConfigFile.askAndAddAuth(String source, String username, String password, String authType, Boolean verify)
at <StartupCode$Paket-Core>.$PublicAPI.AddCredentials@177-6.Invoke(Unit unitVar0)
at Paket.Utils.RunInLockedAccessMode[a](String rootFolder, FSharpFunc2 action) at Paket.Program.handleCommand@737-3.Invoke(ParseResults1 results)
at Paket.Program.processWithValidationEx$cont@37[a](Boolean silent, FSharpFunc`2 commandF, a result, Unit unitVar)
at Paket.Program.handleCommand(Boolean silent, Command command)
at Paket.Program.main()
at <StartupCode$paket>.$Paket.Program.main@()

Known workarounds

If you supply --authtype basic the command bypasses the Console.ReadLine() command which is the source of the error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions