Module: QAT::Jenkins

Defined in:
lib/qat/jenkins.rb

Overview

Jenkins helper. Should be required by the Cucumber module then running tests in a Jenkins server.

Since:

  • 0.1.0

Constant Summary collapse

DEFAULT_ENV_VARS =

Default Jenkins environment variables to add register in the QAT::Logger.

Since:

  • 0.1.0

[
  'BUILD_NUMBER',
  'BUILD_URL',
  'NODE_NAME',
  'JOB_NAME',
  'SVN_REVISION',
  'GIT_COMMIT'
]

Class Method Summary collapse

Class Method Details

.register_vars(opts = {}) ⇒ Object

Register Jenkins environment variables in the Log4r::MDC hash. By default only the DEFAULT_ENV_VARS will be registered.

Parameters:

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

    Options to modify default registry

Options Hash (opts):

  • :ignore (Array<String>) — default: []

    List of default environment variables to ignore.

  • :add (Array<String>) — default: []

    List of non default environment variables to add.

See Also:

Since:

  • 0.1.0



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/qat/jenkins.rb', line 30

def self.register_vars(opts={})
  ignore_list = opts[:ignore] || []
  add_list    = opts[:add] || []

  list = DEFAULT_ENV_VARS + add_list - ignore_list

  list.each do |var|
    Log4r::MDC.put var, ENV[var] if ENV[var]
  end

end