3

I am trying to run groovysh on my Jenkins from the cli, using the following command:

java -jar jenkins-cli.jar -s <Jenkins URL> -i JenkinsPrivateKey.ppk groovysh

I generated this private key file using PuttyGen, and pasted the public key into the SHH Public Keys box on the /me/configure page of the Jenkins. It's not that the key doesn't work - it seems like it's not authenticating at all. When I run who-am-i using the cli:

java -jar jenkins-cli.jar -s <Jenkins URL> -i JenkinsPrivateKey.ppk who-am-i

It gives me a response of:

Authenticated as: anonymous

What am I missing here? I thought if the authentication failed it would at least display an error message of some kind. Is there any way to verify that the private key actually works?

Edit: After some experimentation, it seems that authentication via the CLI does fail silently - I put a bogus public key in my profile configuration, and I still saw no error.

quietkatalyst
  • 97
  • 2
  • 8

1 Answers1

2

You may need to convert your putty keys to openssh format for them to work properly with the key.

See https://wiki.cloudbees.com/bin/view/DEV/Customer%2BProvided%2BSlaves%2BWindows

"Back to Putty Key Generator, use Conversions > Export OpenSSH key to save the private key to a file."

If that works, feel free to edit the Jenkins CLI wiki page!

coffeebreaks
  • 3,787
  • 1
  • 26
  • 25
  • Thanks very much! I'd like to add it to the wiki page as well. Is it okay to link to the tutorial? – quietkatalyst Aug 13 '13 at 13:44
  • The tutorial is from cloudbees and relates to other features as well. I would prefer the Jenkins wiki to be self contained with regard to that information. – coffeebreaks Aug 13 '13 at 14:50