Module: Performa::Coordinator

Extended by:
ShellHelper
Defined in:
lib/performa/coordinator.rb

Class Method Summary collapse

Methods included from ShellHelper

run_capture_command, run_command, run_container_command, run_no_capture_command

Class Method Details

.process_env(env, config:) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/performa/coordinator.rb', line 22

def process_env(env, config:)
  LOG.info_notice("Processing #{env.name}")
  container_id = Images.process(env, config: config)
  run_container_command(container_id, config["command"], success_only: false)
rescue CommandFailureError => error
  error.message
ensure
  ContainerRegistry.kill(container_id) if container_id
end

.run(config) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/performa/coordinator.rb', line 9

def run(config)
  envs = Environment.all(config)
  results = {}

  envs.each do |env|
    results[env.name] = process_env(env, config: config)
  end

  ResultsHelper.process(results, config: config)
ensure
  ContainerRegistry.kill_all
end