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

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

Closed
caveman-dick opened this Issue Nov 3, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@caveman-dick

caveman-dick commented Nov 3, 2017

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.

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