Sha256: e65534503dc3e1962fe50c729431171ea51d25ee8def50d72771cbc866004099

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

#!/usr/bin/env ruby

require 'remote_syslog_logger'
require_relative '../lib/gooddata'

DEFAULT_BRICK = 'hello_world_brick'
BRICK_PARAM_PREFIX = 'BRICK_PARAM_'

brick_type = !ARGV.empty? ? ARGV[0] : DEFAULT_BRICK

syslog_node = ENV['NODE_NAME']
log = RemoteSyslogLogger.new(syslog_node, 514, :program => "ruby_#{brick_type}", :facility => 'local2')

log.info "action=#{brick_type}_execution status=init"

begin
  brick_pipeline = GoodData::Bricks::Pipeline.send("#{brick_type}_pipeline")
  params = ENV.select { |k,| k.to_s.match(/^#{BRICK_PARAM_PREFIX}.*/) }.map { |k, v| [k.slice(BRICK_PARAM_PREFIX.length..-1), v] }.to_h
  commit_hash = ENV['GOODDATA_RUBY_COMMIT'] || ''
  params['gooddata_ruby_commit'] = commit_hash
  params['log_directory'] = ENV['LOG_DIRECTORY'] || '/tmp/'
  log.info "action=#{brick_type}_execution status=start commit_hash=#{commit_hash}"
  @brick_result = brick_pipeline.call(params)
  log.info "action=#{brick_type}_execution status=finished"
rescue NoMethodError => e
  log.info "action=#{brick_type}_execution status=error Invalid brick type '#{brick_type}', #{e.message}"
  raise e
rescue => e
  log.info "action=#{brick_type}_execution status=error #{e.message}"
  raise e
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gooddata-1.3.3-java bin/run_brick.rb
gooddata-1.3.3 bin/run_brick.rb