Module: Jenkins::Listeners::RunListener

Extended by:
Plugin::Behavior
Includes:
Extension
Defined in:
lib/jenkins/listeners/run_listener.rb

Overview

Receive notification of build events.

Include this module in your class in order to receive callbacks when builds are started, completed, deleted, etc…

To receive a callback, override the method with the same name as the event. E.g.

class MyRunListener
  include Jenkins::Listeners::RunListener

  def started(build, listener)
    puts "build.inspect started!"
  end
end

Instance Method Summary collapse

Methods included from Plugin::Behavior

extended, implemented, included

Methods included from Plugin::Behavior::BehavesAs

#behaves_as

Instance Method Details

#completed(build, listener) ⇒ Object

Called after a build is completed.

Parameters:

  • the (Jenkins::Model::Build)

    completed build

  • the (Jenkins::Model::TaskListener)

    task listener for this build



38
39
# File 'lib/jenkins/listeners/run_listener.rb', line 38

def completed(build, listener)
end

#deleted(build) ⇒ Object

Called right before a build is going to be deleted.

Parameters:



53
54
# File 'lib/jenkins/listeners/run_listener.rb', line 53

def deleted(build)
end

#finalized(build) ⇒ Object

Called after a build is finalized.

At this point, all the records related to a build is written down to the disk. As such, task Listener is no longer available. This happens later than #completed.

Parameters:



47
48
# File 'lib/jenkins/listeners/run_listener.rb', line 47

def finalized(build)
end

#started(build, listener) ⇒ Object

Called when a build is started (i.e. it was in the queue, and will now start running on an executor)

Parameters:

  • the (Jenkins::Model::Build)

    started build

  • the (Jenkins::Model::TaskListener)

    task listener for this build



31
32
# File 'lib/jenkins/listeners/run_listener.rb', line 31

def started(build, listener)
end