Quantcast

Scripted Access to Jenkins and Authentication

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Scripted Access to Jenkins and Authentication

Mandeville, Rob

I require logins into Jenkins on my server, and I’m trying to generate jobs from templates.  That is, I want to grab a job’s config.xml from the Jenkins web site, make my own changes, and present a new job through the XML interface.

 

My problem is accessing the server via anything but a web browser.  I can’t figure out how to present credentials in a way that Jenkins will accept in any non-browser client I can think of.  I’m in a Linux shop have tried curl, wget, and Perl’s LWP library.

 

I think that a related issue is that, if you’re not pre-authenticated, attempting to reach a link that isn’t publicly accessible doesn’t result in a credentials challenge, but a 404 error.  This is confusing my users to no end.

 

Is there an easy way around the 404 errors, and/or any reasonable way to authenticate a command-line client to Jenkins?

 

Thanks in advance,

 

--Rob Mandeville

Litle & Co.

 

 

NOTICE: This message, including all attachments transmitted with it, is for the use of the addressee only. It may contain proprietary, confidential, attorney work product and/or attorney/client privileged information belonging to Litle & Co. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient, you must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message. If you believe you have received this message in error, please delete it and all copies of it from your system and notify the sender immediately. Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scripted Access to Jenkins and Authentication

Jerome Lacoste-3
On Tuesday, July 19, 2011 8:15:11 PM UTC+2, Mandeville, Rob wrote:
> I require logins into Jenkins on my server, and I’m trying to generate jobs from templates. 
> That is, I want to grab a job’s config.xml from the Jenkins web site, make my own changes, 
> and present a new job through the XML interface.

> My problem is accessing the server via anything but a web browser. I can’t figure out how to present credentials 
> in a way that Jenkins will accept in any non-browser client I can think of. I’m in a Linux shop have tried curl, wget, and Perl’s LWP library.


J
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scripted Access to Jenkins and Authentication

Didier Durand
Hi,

Personnally, I could do it in Java using the samples of parag 4.8 of
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html

The main issue for me was "preemptive authentication" as described in
the url above.

regards

didier

On Jul 19, 8:22 pm, Jerome Lacoste <[hidden email]> wrote:

> On Tuesday, July 19, 2011 8:15:11 PM UTC+2, Mandeville, Rob wrote:
> > I require logins into Jenkins on my server, and I’m trying to generate
>
> jobs from templates.> That is, I want to grab a job’s config.xml from the Jenkins web site, make
> my own changes,
> > and present a new job through the XML interface.
>
> > My problem is accessing the server via anything but a web browser. I can’t
>
> figure out how to present credentials> in a way that Jenkins will accept in any non-browser client I can think
>
> of. I’m in a Linux shop have tried curl, wget, and Perl’s LWP library.
>
> Have you readhttps://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+c...
>  ?
>
> J
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scripted Access to Jenkins and Authentication

Tom Wood
You can use wget as described on the wiki:
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients

If you fancy using Python check out the library in development at:
https://launchpad.net/python-jenkins (use the latest SCM version, the
released version is a little old) - if you look at the code you'll see
how you can set the authentication headers for the request.

I guess similar things ought to be possible in whatever your choice of
scripting language...




> > On Tuesday, July 19, 2011 8:15:11 PM UTC+2, Mandeville, Rob wrote:
> > > I require logins into Jenkins on my server, and I’m trying to generate
>
> > jobs from templates.> That is, I want to grab a job’s config.xml from the Jenkins web site, make
> > my own changes,
> > > and present a new job through the XML interface.
>
> > > My problem is accessing the server via anything but a web browser. I can’t
>
> > figure out how to present credentials> in a way that Jenkins will accept in any non-browser client I can think
>
> > of. I’m in a Linux shop have tried curl, wget, and Perl’s LWP library.
>
> > Have you readhttps://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+c...
> >  ?
>
> > J
Loading...