Skip to content

beeplove/hudson-remote-api-mkhan

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hudson-remote-api is ruby library to talk to Hudson's xml remote access api

Usage:

require 'hudson-remote-api'

# Auto Configuration sets Hudson[:url]
Hudson.auto_config

# Manual Configuration
Hudson[:url] = 'http://localhost:8080'
Hudson[:user] = 'hudson'
Hudson[:password] = 'password'

# To turn off checking for crumbIssuer
Hudson[:crumb] = false

# List all Hudson jobs
Hudson::Job.list

# List all active Hudson jobs
Hudson::Job.list_active

# print the last build number of a job
j = Hudson::Job.new('jobname')
puts j.last_build

# if you are using hudson.plugins.git.GitSCM
j.repository_url = { :url => 'https://github.com/beeplove/hudson-remote-api-mkhan.git', :branch => 'origin/master' }
# or, only to change branch
j.repository_url = { :branch => 'origin/master' }

# Set build trigger
j.triggers = { 'hudson.triggers.SCMTrigger' => '* * * * *'}
# or, using shortcut
j.triggers = { 'SCMTrigger' => '* * * * *', 'TimerTrigger' => '0 22 * * *'}

# To add or update a trigger in existing triggers
j.triggers = j.triggers.merge({ 'hudson.triggers.TimerTrigger' => '0 22 * * *'})
# Avoid using shortcut form when to edit a trigger in existing triggers

# To delete existing triggers
j.triggers = {}
# or,
j.triggers = nil

# To view current trigger
j.triggers
# would return hash containing trigger name in key and trigger spec in value.
# Example of returned hash: {"hudson.triggers.TimerTrigger"=>"0 22 * * *", "hudson.triggers.SCMTrigger"=>"* * * * *"}

About

Ruby interface to Hudson's remote xml API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%