aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorPeter Wilmott <p@p8952.info>2015-02-28 21:34:31 +0000
committerPeter Wilmott <p@p8952.info>2015-02-28 21:34:31 +0000
commitaf1f970d49db390ec7f31cfc6821794549153c87 (patch)
tree507a90f5a5bae616fa21eade26f24a0d37cafabd /web
parentUse a dedicated container to cache binary packages (diff)
downloadruby-tinderbox-af1f970d49db390ec7f31cfc6821794549153c87.tar.gz
ruby-tinderbox-af1f970d49db390ec7f31cfc6821794549153c87.tar.bz2
ruby-tinderbox-af1f970d49db390ec7f31cfc6821794549153c87.zip
Run multiple containers in parallel for repoman jobs
Diffstat (limited to 'web')
-rw-r--r--web/lib/repoman.rb38
1 files changed, 19 insertions, 19 deletions
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