Module: Jujube::DSL

Includes:
Components
Defined in:
lib/jujube/dsl.rb

Overview

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

Instance Method Summary collapse

Methods included from Components::Publishers

#archive, #build, #cppcheck, #email_ext, #fitnesse, #gitlab_notifier, #ircbot, #junit, #trigger, #trigger_parameterized_builds, #unittest, #xunit

Methods included from Components::Builders

#copyartifact, #shell

Methods included from Components::Wrappers

#timeout, #timestamps

Methods included from Components::Triggers

#gitlab, #json, #pollscm, #pollurl, #reverse, #simple, #text, #url, #xml

Methods included from Components::Scm

#bundle, #git, #package, #store

Methods included from Macros

#attribute, #section

Methods included from Components::Properties

#priority_sorter, #throttle

Methods included from Components::Parameters

#string, #validating_string

Methods included from Components::Axes

#label_expression, #slave

Instance Method Details

#job(name) {|job| ... } ⇒ Object

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.

Examples:

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{[email protected] [email protected]})
end

Parameters:

  • name (String)

    The name of the job as will be shown by Jenkins.

Yield Parameters:

  • job (Job)

    The job being created.



33
34
35
# File 'lib/jujube/dsl.rb', line 33

def job(name, &block)
  Job.new(name, &block)
end