From af1f970d49db390ec7f31cfc6821794549153c87 Mon Sep 17 00:00:00 2001 From: Peter Wilmott Date: Sat, 28 Feb 2015 21:34:31 +0000 Subject: Run multiple containers in parallel for repoman jobs --- web/lib/repoman.rb | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'web') diff --git a/web/lib/repoman.rb b/web/lib/repoman.rb index 6808340..1185d2a 100644 --- a/web/lib/repoman.rb +++ b/web/lib/repoman.rb @@ -1,4 +1,4 @@ -def run_repoman(docker_image, num_of_packages) +def run_repoman(ci_image, num_of_packages) packages = [] Package.order { [category, lower(name), version] }.each do |package| target = '' @@ -29,26 +29,26 @@ def run_repoman(docker_image, num_of_packages) end packages = packages.uniq - packages.each do |package| - package = "'" + package + "'" - end - packages = packages.unshift('/ruby-tinderbox/repoman.sh') - - docker_container = docker_image.run(packages) - docker_container.wait(36_000) - - tar = Tempfile.new('tar') - File.open(tar, 'w') do |file| - docker_container.copy('/ruby-tinderbox/repo-logs') do |chunk| - file.write(chunk) - puts chunk + packages.peach(8) do |package| + ci_container = Docker::Container.create( + Cmd: %W[/ruby-tinderbox/repoman.sh #{package}], + Image: ci_image.id + ) + ci_container.start + ci_container.wait(36_000) + + tar = Tempfile.new('tar') + File.open(tar, 'w') do |file| + ci_container.copy('/ruby-tinderbox/repo-logs') do |chunk| + file.write(chunk) + end end - end - Archive::Tar::Minitar.unpack(tar, File.dirname(File.expand_path(File.dirname(__FILE__)))) - tar.close - tar.unlink + Archive::Tar::Minitar.unpack(tar, File.dirname(File.expand_path(File.dirname(__FILE__)))) + tar.close + tar.unlink - docker_container.delete + ci_container.delete + end end def update_repoman -- cgit v1.2.3-65-gdbad