diff options
author | Peter Wilmott <p@p8952.info> | 2015-02-07 22:03:07 +0000 |
---|---|---|
committer | Peter Wilmott <p@p8952.info> | 2015-02-13 00:09:49 +0000 |
commit | c90672132096e8695ce17b034d77e12a945244fb (patch) | |
tree | cb200744a09bdde5b26bdbf6f5048f06211734c3 /web/lib/ci.rb | |
parent | Add repoman tidy task to clear entries with all targets enabled (diff) | |
download | ruby-tinderbox-c90672132096e8695ce17b034d77e12a945244fb.tar.gz ruby-tinderbox-c90672132096e8695ce17b034d77e12a945244fb.tar.bz2 ruby-tinderbox-c90672132096e8695ce17b034d77e12a945244fb.zip |
Replace Vagrant with Docker
This replaces the underlying build system with one based around docker.
This is for the following reasons:
1. Portability - Builds can be run on cloud services without spinning up
a second VM.
2. Reduced Overhead - There is a non-negligible increase in compile
times when you are running in Docker vs VirtualBox.
3. Coolness - Docker is cool, I wanted an excuse to use it.
Diffstat (limited to 'web/lib/ci.rb')
-rw-r--r-- | web/lib/ci.rb | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/web/lib/ci.rb b/web/lib/ci.rb index 64d649e..153cc2f 100644 --- a/web/lib/ci.rb +++ b/web/lib/ci.rb @@ -1,4 +1,4 @@ -def run_ci(num_of_packages, provisioner) +def run_ci(docker_image, num_of_packages) packages = [] Package.order { [category, lower(name), version] }.each do |package| packages << package[:identifier] @@ -32,17 +32,22 @@ def run_ci(num_of_packages, provisioner) packages = packages.sample(num_of_packages) end - exit if packages.empty? + packages = packages.uniq + packages.each do |package| + docker_container = docker_image.run("/ruby-tinderbox/tinder.sh #{package}") + docker_container.wait(36_000) - begin - vagrant_path = File.dirname(File.dirname(File.expand_path(File.dirname(__FILE__)))) - vagrant = Vagrant_Rbapi.new(vagrant_path) - vagrant.up(provisioner) - sleep 5 while vagrant.status != 'running' - vagrant.ssh('sudo /vagrant/tinder.sh ' + packages.join(' ')) - vagrant.scp(:download, true, '/vagrant/ci-logs', 'web') - ensure - vagrant.destroy + tar = Tempfile.new('tar') + File.open(tar, 'w') do |file| + docker_container.copy('/ruby-tinderbox/ci-logs') do |chunk| + file.write(chunk) + end + end + Archive::Tar::Minitar.unpack(tar, File.dirname(File.expand_path(File.dirname(__FILE__)))) + tar.close + tar.unlink + + docker_container.delete end end |