19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/baps/executor.rb', line 19
def execute
if !@definitions || @definitions.empty?
puts 'No definition to execute'
return
end
return @definitions.each(&:execute) unless @use_docker
errors = {}
@definitions.each do |definition|
cmd = "exe/baps -p #{path_in_docker} --no-docker"
cmd << ' --no-publish' unless @@publish
container = base_container.run(cmd)
container.attach { |stream, chunk| puts "#{stream}: #{chunk}" }
if (code = container.wait(Baps::TIMEOUT)['StatusCode']) > 0
errors[definition] = code
end
end
unless errors.empty?
raise ExecutorError, errors.map { |d, c| "#{d.path} exited with #{c}" }.join("\n")
end
end
|