Reputation: 107
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.
Upvotes: 3
Views: 8348
Reputation: 3817
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!
Upvotes: 2