cliffano / nestor

Jenkins CLI and node.js client
http://blog.cliffano.com/tag/nestor/
MIT License
181 stars 27 forks source link

Interactive mode for authentication when triggering builds #16

Closed chr0n1x closed 11 years ago

chr0n1x commented 11 years ago

Right now if credentials are enabled, the JENKINS_URL env var needs to be set.

Would it be possible to go into an interactive mode to have the user input their credentials instead? If an interactive flag were set?

Is it possible to set the URL itself as a flag?

cliffano commented 11 years ago

Definitely doable.

I'll need to implement some sort of an authentication fallback mechanism:

chr0n1x commented 11 years ago

looking forward to trying it out :)

cliffano commented 11 years ago

Btw, is security the reason why you don't want to add credentials as environment variable? Would using Jenkins token instead of password be any help?

chr0n1x commented 11 years ago

I have multiple Jenkins masters on different environments with different builds but one central location that I access them from so having the option of spinning off multiple tasks via flags seems conceptually easier than using a token per node. Also, I figured that it would make Nestor more flexible overall.

chr0n1x commented 11 years ago

Do you have time to do this, @cliffano ?

cliffano commented 11 years ago

@chr0n1x Managed to squeeze in a quick change during lunch break. Could you please give it a try? git clone http://github.com/cliffano/nestor cd nestor npm link nestor --url --interactive dashboard (that should prompt your username and password, which is then used with the jenkinsUrl) JENKINS_URL= nestor --interactive dashboard (like above, but used with environment variable)

Please let me know if that works for you and if there's anything missing. I will publish it to npm registry after tidying things up.

chr0n1x commented 11 years ago

First thing: this doesn't seem to work remotely...

[chr0n1x@durdur nestor]# nestor --url derpderp.my.lan dashboard
Jobless Jenkins

Nope.

[chr0n1x2189@derpderp nestor]# nestor --url derpderp.my.lan dashboard
... a lot of stuff

Yes, I can ping derpderp from durdur.

As for the actual feature, I'm getting ETIMEDOUT between the same machines.

Am I doing something wrong?

cliffano commented 11 years ago

Can you use wget or curl to get derpderp.my.lan/api/json from both durdur and derpderp?

Are you sitting behind a proxy?

chr0n1x commented 11 years ago

Yes I can hit derpderp from durdur via wget / curl. No, I am not sitting behind a proxy.

chr0n1x commented 11 years ago

Also, I have an instance of Jenkins running on both. @cliffano

cliffano commented 11 years ago

Sorry, I just got some time to look at this issue.

The default timeout is set too low (2 seconds) which camouflages the response. Will fix it asap.

cliffano commented 11 years ago

I've published nestor v0.1.6, could you please give it another try?

npm install -g nestor nestor --version (should show 0.1.6)

chr0n1x commented 11 years ago

@cliffano it worked! Awesome, and thank you :)

cliffano commented 11 years ago

Glad to help :)