Duplicate base boxes tasks and start versioning them too

This commit is contained in:
Fabio Rehm 2013-06-06 00:12:40 -03:00
parent cb1f72923a
commit ed4a8ae729
2 changed files with 123 additions and 41 deletions

View file

@ -1,7 +1,7 @@
require 'pathname' require 'pathname'
require 'rake/tasklib' require 'rake/tasklib'
class BuildGenericBoxTask < ::Rake::TaskLib class BuildGenericBoxTaskV2 < ::Rake::TaskLib
include ::Rake::DSL include ::Rake::DSL
attr_reader :name attr_reader :name
@ -110,13 +110,13 @@ class BuildGenericBoxTask < ::Rake::TaskLib
end end
end end
class BuildDebianBoxTask < BuildGenericBoxTask class BuildDebianBoxTaskV2 < BuildGenericBoxTaskV2
def initialize(name, release, arch, opts = {}) def initialize(name, release, arch, opts = {})
super(name, 'debian', release, arch, opts) super(name, 'debian', release, arch, opts)
end end
end end
class BuildUbuntuBoxTask < BuildGenericBoxTask class BuildUbuntuBoxTaskV2 < BuildGenericBoxTaskV2
def initialize(name, release, arch, opts = {}) def initialize(name, release, arch, opts = {})
super(name, 'ubuntu', release, arch, opts) super(name, 'ubuntu', release, arch, opts)
end end
@ -127,22 +127,23 @@ puppet = ENV['PUPPET'] == '1'
babushka = ENV['BABUSHKA'] == '1' babushka = ENV['BABUSHKA'] == '1'
namespace :boxes do namespace :boxes do
namespace :v2 do
namespace :ubuntu do namespace :ubuntu do
namespace :build do namespace :build do
desc 'Build an Ubuntu Precise 64 bits box' desc 'Build an Ubuntu Precise 64 bits box'
BuildUbuntuBoxTask. BuildUbuntuBoxTaskV2.
new(:precise64, new(:precise64,
:precise, 'amd64', chef: chef, puppet: puppet, babushka: babushka) :precise, 'amd64', chef: chef, puppet: puppet, babushka: babushka)
desc 'Build an Ubuntu Quantal 64 bits box' desc 'Build an Ubuntu Quantal 64 bits box'
BuildUbuntuBoxTask. BuildUbuntuBoxTaskV2.
new(:quantal64, new(:quantal64,
:quantal, 'amd64', chef: chef, puppet: puppet, babushka: babushka) :quantal, 'amd64', chef: chef, puppet: puppet, babushka: babushka)
# FIXME: Find out how to install chef on raring # FIXME: Find out how to install chef on raring
desc 'Build an Ubuntu Raring 64 bits box' desc 'Build an Ubuntu Raring 64 bits box'
BuildUbuntuBoxTask. BuildUbuntuBoxTaskV2.
new(:raring64, new(:raring64,
:raring, 'amd64', chef: false, puppet: puppet, babushka: babushka) :raring, 'amd64', chef: false, puppet: puppet, babushka: babushka)
@ -155,17 +156,17 @@ namespace :boxes do
namespace :debian do namespace :debian do
namespace :build do namespace :build do
desc 'Build an Debian Squeeze 64 bits box' desc 'Build an Debian Squeeze 64 bits box'
BuildDebianBoxTask. BuildDebianBoxTaskV2.
new(:squeeze64, new(:squeeze64,
:squeeze, 'amd64', chef: false, puppet: puppet, babushka: babushka) :squeeze, 'amd64', chef: false, puppet: puppet, babushka: babushka)
desc 'Build an Debian Wheezy 64 bits box' desc 'Build an Debian Wheezy 64 bits box'
BuildDebianBoxTask. BuildDebianBoxTaskV2.
new(:wheezy64, new(:wheezy64,
:wheezy, 'amd64', chef: false, puppet: puppet, babushka: babushka) :wheezy, 'amd64', chef: false, puppet: puppet, babushka: babushka)
desc 'Build an Debian Sid/unstable 64 bits box' desc 'Build an Debian Sid/unstable 64 bits box'
BuildDebianBoxTask. BuildDebianBoxTaskV2.
new(:sid64, new(:sid64,
:sid, 'amd64', chef: false, puppet: puppet, babushka: babushka) :sid, 'amd64', chef: false, puppet: puppet, babushka: babushka)
@ -176,4 +177,5 @@ namespace :boxes do
desc 'Build all base boxes for release' desc 'Build all base boxes for release'
task :build_all => %w( ubuntu:build:all debian:build:all ) task :build_all => %w( ubuntu:build:all debian:build:all )
end
end end

80
tasks/boxes.v3.rake Normal file
View file

@ -0,0 +1,80 @@
require 'pathname'
require 'rake/tasklib'
load 'tasks/boxes.v2.rake'
class BuildGenericBoxTaskV3 < BuildGenericBoxTaskV2
def build
# TODO: Build the base box and lxc-create it somehow
super
end
end
class BuildDebianBoxTaskV3 < BuildGenericBoxTaskV3
def initialize(name, release, arch, opts = {})
super(name, 'debian', release, arch, opts)
end
end
class BuildUbuntuBoxTaskV3 < BuildGenericBoxTaskV3
def initialize(name, release, arch, opts = {})
super(name, 'ubuntu', release, arch, opts)
end
end
chef = ENV['CHEF'] == '1'
puppet = ENV['PUPPET'] == '1'
babushka = ENV['BABUSHKA'] == '1'
namespace :boxes do
namespace :v3 do
namespace :ubuntu do
namespace :build do
desc 'Build an Ubuntu Precise 64 bits box'
BuildUbuntuBoxTaskV3.
new(:precise64,
:precise, 'amd64', chef: chef, puppet: puppet, babushka: babushka)
desc 'Build an Ubuntu Quantal 64 bits box'
BuildUbuntuBoxTaskV3.
new(:quantal64,
:quantal, 'amd64', chef: chef, puppet: puppet, babushka: babushka)
# FIXME: Find out how to install chef on raring
desc 'Build an Ubuntu Raring 64 bits box'
BuildUbuntuBoxTaskV3.
new(:raring64,
:raring, 'amd64', chef: false, puppet: puppet, babushka: babushka)
desc 'Build all Ubuntu boxes'
task :all => %w( precise64 quantal64 raring64 )
end
end
# FIXME: Find out how to install chef on debian boxes
namespace :debian do
namespace :build do
desc 'Build an Debian Squeeze 64 bits box'
BuildDebianBoxTaskV3.
new(:squeeze64,
:squeeze, 'amd64', chef: false, puppet: puppet, babushka: babushka)
desc 'Build an Debian Wheezy 64 bits box'
BuildDebianBoxTaskV3.
new(:wheezy64,
:wheezy, 'amd64', chef: false, puppet: puppet, babushka: babushka)
desc 'Build an Debian Sid/unstable 64 bits box'
BuildDebianBoxTaskV3.
new(:sid64,
:sid, 'amd64', chef: false, puppet: puppet, babushka: babushka)
desc 'Build all Debian boxes'
task :all => %w( squeeze64 wheezy64 sid64 )
end
end
desc 'Build all base boxes for release'
task :build_all => %w( ubuntu:build:all debian:build:all )
end
end