Labels

ruby (2) hudson (1) puppet (1)

Wednesday, September 1, 2010

Hudson Ruby Gem

Today I created my first Ruby gem and published it on Gemcutter: hudson-remote-api.
The source code is available on GitHub: http://github.com/Druwerd/hudson-remote-api

This gem allows you to interact with Hudson's remote access api using Ruby. So far the features include triggering builds, disabling jobs, copying jobs, updating job configuration and more.

I have used this set of scripts to automated many tasks with Hudson. Here are some examples of what you can do.

Get a list of all Hudson jobs currently building:
Hudson::Job.list_active

List all Hudson jobs in the build queue:
Hudson::BuildQueue.list

Get the next build number for a Hudson job:
job = Hudson::Job.new('jobname')
job.next_build_number

Trigger a build:
job = Hudson::Job.new('jobname')
job.build

Create a new Hudson job to build from an SVN branch:
job1 = Hudson::Job.new('jobname')
job2 = job1.copy
job2.repository_url = job2.repository_url.sub("trunk", "branches")

0 comments:

Post a Comment