class Lita::Handlers::DaysSinceMasterFailure

Watch buildkite webhooks for build failures of the master branch, and track how long the team can go without a failure

Public Instance Methods

timestamp_failure(payload) click to toggle source
# File lib/lita/days_since_master_failure.rb, line 14
def timestamp_failure(payload)
  event = payload[:event]

  if event.branch == "master" && event.name == "build.finished"
    process_build_finished(event) do |msg|
      robot.send_message(target, msg)
    end
  end
end

Private Instance Methods

process_build_finished(event) { |message| ... } click to toggle source
# File lib/lita/days_since_master_failure.rb, line 26
def process_build_finished(event, &block)
  repository(event).record_result(event) do |message|
    yield message
  end
end
repository(event) click to toggle source
# File lib/lita/days_since_master_failure.rb, line 32
def repository(event)
  DaysSinceMasterFailureRepository.new(redis, event.pipeline)
end
target() click to toggle source
# File lib/lita/days_since_master_failure.rb, line 36
def target
  Source.new(room: Lita::Room.find_by_name(config.channel_name) || "general")
end