Class: TriggeredJobHelper

Inherits:
ExtensionHelper show all
Defined in:
lib/jenkins_pipeline_builder/extensions/helpers/build_steps/triggered_job.rb

Instance Attribute Summary

Attributes inherited from ExtensionHelper

#builder, #params

Instance Method Summary collapse

Methods inherited from ExtensionHelper

#initialize

Constructor Details

This class inherits a constructor from ExtensionHelper

Instance Method Details

#block_condition?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/jenkins_pipeline_builder/extensions/helpers/build_steps/triggered_job.rb', line 24

def block_condition?
  respond_to?(:block_condition) && block_condition != false
end

#generate_for_threshold(xml_builder, threshold_type) ⇒ Object

Parameters:

  • xml_builder (Nokogiri::Builder)

    this will be self inside an extension

  • threshold_type (String, Symbol)

    case-insensitive string or symbol from the %(failure unstable success)



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/jenkins_pipeline_builder/extensions/helpers/build_steps/triggered_job.rb', line 6

def generate_for_threshold(xml_builder, threshold_type)
  case threshold_type
  when /failure/i, :failure
    generate_threshold_xml({ name: 'FAILURE', ordinal: 2, color: 'RED' }, xml_builder)
  when /unstable/i, :unstable
    generate_threshold_xml({ name: 'UNSTABLE', ordinal: 1, color: 'YELLOW' }, xml_builder)
  when /success/i, :success
    generate_threshold_xml({ name: 'SUCCESS', ordinal: 0, color: 'BLUE' }, xml_builder)
  else
    raise ArgumentError("Input should be one of the following either as a case insensitive string or symbol: \n
                        'failure', 'unstable', 'success'")
  end
end

#resolve_block_condition(key) ⇒ Object



20
21
22
# File 'lib/jenkins_pipeline_builder/extensions/helpers/build_steps/triggered_job.rb', line 20

def resolve_block_condition(key)
  try(:block_condition).try([], key)
end