module Jujube::DSL

The top-level DSL to be used when defining jobs.

Public Instance Methods

job(name, &block) click to toggle source

Define a new Jenkins job.

Takes a configuration block that is used to configure the job by setting attribute values and adding components to the various sections of the job.

@example

job "my-job" do |j|
  j.description = "This is my job."  # Specify attributes
  j.quiet_period = 5

  j.axes << slave(:arch, %w{i386 amd64}) # Add components to sections

  j.scm << git(url: "https://example.com/git/my-project", branches: %w{master dev})

  j.triggers << pollscm("@hourly")

  j.wrappers << timeout(type: 'elastic', elastic_percentage: 150, elastic_default_timeout: 5, fail: true)
  j.wrappers << timestamps

  j.builders << shell("bundle && bundle exec rake deploy")

  j.publishers << email_ext(recipients: %w{me@example.com you@example.com})
end

@param name [String] The name of the job as will be shown by Jenkins. @yieldparam job [Job] The job being created.

# File lib/jujube/dsl.rb, line 33
def job(name, &block)
  Job.new(name, &block)
end