Subordinate Build Status Code Climate Coverage Status

Subordinate is a api wrapper for the Jenkins API. It is not exhaustive at the moment and is being built out.

Installation

Add this line to your application's Gemfile:

gem 'subordinate'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install subordinate

Documentation

http://rdoc.info/github/jasontruluck/subordinate/master/index

Configuration

Configuration allows for specifying your Jenkins instances variables

domain - The domain of your Jenkins server i.e. example.com

subdomain - The subdomain of your Jenkins server i.e. jenkins

port - The port of your Jenkins server i.e. 8080

ssl - If you would like to use ssl [Boolean]

Within an initializer config/initializer/subordinate.rb

Subordinate.configure do |c|
  c.subdomain = "subdomain"
  c.domain    = "domain"
  c.port      = 1234
  c.ssl       = false
end

Examples

Setting up a new client

client = Subordinate::Client.new(:username => "username", :api_token =>"token")

or ruby client = Subordinate.new(:username => "username", :api_token =>"token")

You can also pass configuration keys such as domain, subdomain, port etc. as well.

Jobs

Currently offers the ability to build, delete, enable/disable jobs

client.job("Job-Name")

Builds

Currently can retrieve information, console output, and timestamps

client.build("Job-Name", 1)

Views

Currently can retrieve all views, information about a single view, add jobs to a view, and remove jobs from a view

client.all_views
client.view("My-Awesome-View-Name")

System

Currently can safe restart, restart, and quiet down

client.restart

People

Retrieve the users on the Jenkins server

client.people

Build Queue

Retrieves the current build queue for the Jenkins server

client.build_queue

Build Executor

Retrieves the build executors status and information from the Jenkins server

client.build_executor

Load Statistics

Retrieves the load statistics from the Jenkins server

client.load_statistics

Using Depth query parameter

For methods that allow you to specify a depth simply pass the depth you want via an option

client.job("My-awesome-job", {:depth => 1})

The default depth is 0 for all methods.

Using Tree query parameters

tree parameters are more efficient than using depth with exclude. They are available ot any methods that except them via options as well

client.root({:tree => "jobs[name],views[name,jobs[name]]"})

A note from Jenkins: for array-type properties (such as jobs in this example), the name must be given in the original plural, not in the singular as the element would appear in XML (). This will be more natural for e.g. json?tree=jobs[name] anyway: the JSON writer does not do plural-to-singular mangling because arrays are represented explicitly.

Please see the docs for more info on tree parameters

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request