File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ruby and the fly likes posting a modified hudson build config using Ruby script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Languages » Ruby
Bookmark "posting a modified hudson build config using Ruby script" Watch "posting a modified hudson build config using Ruby script" New topic
Author

posting a modified hudson build config using Ruby script

Anadi Misra
Ranch Hand

Joined: Jun 03, 2008
Posts: 69
Hi,

I have a ruby script that creates a release branch from trunk at the start of every release cycle in my project. we recently moved to hudson so I though it will be good if the script itself downloads and modifies Hudson release build config and posts it back. I read from here that it is possible to programatically modify the configuration on Hudson and POST the same XML.

For example if the build is at URL http://somthing.builder.ad/hudson/job/branch then http://somthing.builder.ad/hudson/job/branch/config.xml is the configuration that can be modify and POST-ed back at the latter URL.

My ruby script always gives a 400. please help. here's the script



I also tried the RestClient but it seems that does not support POST'ing files


Anadi Mishra.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi,
Have you tried posting your xml file using some http utility tools like Poster in Firefox to your hudson server ('http://my.buildserver.com/hudson/job/branch/config.xml') ?
Does it accept such submission ?
Regards
Balaji


Spritle Software Blogs
Anadi Misra
Ranch Hand

Joined: Jun 03, 2008
Posts: 69
hi,

thanks I tried usign the Poster and got it to work when i changed Content-Type header to text/xml however when i tried from the ruby code after making changes I got this error



here's the updated script

Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
It seems that you're trying to pass in a REXML document to http.get() while it's expecting a String.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: posting a modified hudson build config using Ruby script
 
Similar Threads
Using config.xml in weblogic 6.1
Help Needed regarding the automation of the build process
XML mapping framework
Maven: No SCM URL was provided to perform the release from
glassfish auto-generates unwanted session