Module: Jujube::Components::Publishers

Extended by:
Macros
Included in:
Jujube::Components
Defined in:
lib/jujube/components/publishers.rb

Overview

Helper methods for creating publisher components.

trigger_parameterized_builds Builds collapse

xunit Test Types collapse

Instance Method Summary collapse

Instance Method Details

#archive(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



15
# File 'lib/jujube/components/publishers.rb', line 15

standard_component :archive

#build(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the build.

Returns:

  • (Hash)

    The specification for the build.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/jujube/components/publishers.rb', line 135

def build(options = {})
  identity = ->(value) { value }
  transforms = {
      predefined_parameters: ->(value) do
        result = value.map { |k,v| "#{k}=#{v}" }.join("\n")
        value.size > 1 ? result + "\n" : result
      end,
      boolean_parameters: ->(value) do
        Hash[value.map { |k,v| [k.to_s, v] }]
      end,
      git_revision: ->(value) do
        value.is_a?(Hash) ? canonicalize_options(value) : value
      end
  }
  transformed_options = options.map do |k, v|
    transform = transforms.fetch(k) { identity }
    [k, transform.call(v)]
  end

  canonicalize_options(Hash[transformed_options])
end

#cppcheck(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



24
# File 'lib/jujube/components/publishers.rb', line 24

standard_component :cppcheck

#email_ext(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



33
# File 'lib/jujube/components/publishers.rb', line 33

standard_component :email_ext

#fitnesse(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



42
# File 'lib/jujube/components/publishers.rb', line 42

standard_component :fitnesse

#gitlab_notifier(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



51
# File 'lib/jujube/components/publishers.rb', line 51

standard_component :gitlab_notifier

#gtest(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the test type.

Returns:

  • (Hash)

    The specification for the test type.



168
# File 'lib/jujube/components/publishers.rb', line 168

named_config :gtest

#ircbot(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



60
# File 'lib/jujube/components/publishers.rb', line 60

standard_component :ircbot

#junit(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



69
# File 'lib/jujube/components/publishers.rb', line 69

standard_component :junit

#trigger(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the component.

Returns:

  • (Hash)

    The specification for the component.



78
# File 'lib/jujube/components/publishers.rb', line 78

standard_component :trigger

#trigger_parameterized_builds {|builds| ... } ⇒ Hash

Specify a trigger-parameterized-builds publisher for a job.

See https://jenkins-job-builder.readthedocs.io/en/latest/publishers.html#publishers.trigger-parameterized-builds.

trigger-parameterized-builds can trigger multiple sets of builds, each with their own configuration. Each build specification is added in a nested configuration block using the #build method.

Examples:

job "trigger-parameterized-builds-example" do |j|
  j.publishers << trigger_parameterized_builds do |builds|
    builds << build(project: %w[PROJECT1 PROJECT2], condition: "SUCCESS")
    builds << build(project: "SINGLE_PROJECT", current_parameters: true)
  end
end

Yield Parameters:

  • builds (Array)

    An array to which nested build specifications should be added by the block.

Returns:

  • (Hash)

    The specification for the component.



99
100
101
102
103
# File 'lib/jujube/components/publishers.rb', line 99

def trigger_parameterized_builds
  builds = []
  yield(builds) if block_given?
  {"trigger-parameterized-builds" => builds}
end

#unittest(options = {}) ⇒ Hash

Parameters:

  • options (Hash) (defaults to: {})

    The configuration options for the test type.

Returns:

  • (Hash)

    The specification for the test type.



177
# File 'lib/jujube/components/publishers.rb', line 177

named_config :unittest

#xunit(options = {}) {|types| ... } ⇒ Hash

Specify an xunit publisher for a job.

See https://jenkins-job-builder.readthedocs.io/en/latest/publishers.html#publishers.xunit.

xunit can publish multiple sets of test results. The specification for each set of test results is added in a nested configuration block using the #unittest method.

Examples:

job "xunit-example" do |j|
  j.publishers << xunit do |types|
    types << unittest(pattern: "PATTERN", deleteoutput: false)
  end
end

Parameters:

  • options (Hash) (defaults to: {})

    Top-level options for configuring the component.

Yield Parameters:

  • types (Array)

    An array to which nested test type specifications should be added by the block.

Returns:

  • (Hash)

    The specification for the component.



123
124
125
# File 'lib/jujube/components/publishers.rb', line 123

def xunit(options = {}, &block)
  to_config("xunit", nested_options(:types, options, &block))
end