Wondering if someone has experience in this area and can help me.

I would like to post groovy scripts to run via the jenkins remote API.  It 
seems like it's possible based on this blog entry:

http://blog.cloudbees.com/2012/01/writing-programs-that-drive-jenkins.html

"One is the REST API access to the Groovy 
console<https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console>, 
which allows administrator users to run arbitrary Groovy scripts inside the 
Jenkins master JVM (and you can submit this script as POST payload, and get 
the response back as the HTTP response). This allows you to tap into all 
the Jenkins object models. "

However, I'm not having much luck getting this to work.  Right now I'm just 
experimenting with curl.  Not sure if I"m using curl incorrectly, or I'm 
not pointing to the correct jenkins URI.

Here is my command:

      curl -X POST -d "println 
2"  http://username:[email protected]/jenkins/script

I would expect that I would get back '2' as a response, but instead I'm 
getting html:

Do I have the URI wrong? I also tried jenkins/script/api but that didn't 
work.

Am I supposed to specify a content-type differently, such as text/xml?  If 
so, what should my post payload look like?

Here's a couple of other data points --

1. I have successfully started builds via curl and GETs so I know my 
username/token is correct and works.
2. I do have authorization to execute groovy scripts.
3. I would be just as happy to execute these scripts via jenkins-ci, but 
ran into problems there as well which I think is a separate issue (that 
being that I'm front ending jenkins with apache mod_proxy and it somehow 
interfering with jenkins cli.

Any help someone could offer would be greatly appreciated.  We've been 
using jenkins succesfully for some time, but I'm now starting the journey 
of automating some of our manual processes and getting programatic access 
to the console is the first step.

Thanks.

Doug





-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to