Created
November 5, 2010 06:15
-
-
Save jeremyd/663723 to your computer and use it in GitHub Desktop.
image jockey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rest_connection' | |
require 'rspec' | |
require 'ruby-debug' | |
CONFIGDIR = File.dirname(__FILE__) | |
def set_params_from_json(server, file) | |
inputs = JSON::load(IO.read(File.join(CONFIGDIR, file))) | |
server.parameters = inputs | |
server.save | |
end | |
def run_recipe(servers, recipe) | |
exe = Executable.new('recipe' => recipe) | |
done = [] | |
servers.each { |b| done << b.run_executable(exe) } | |
done.each { |status| status.wait_for_state("completed", 6000) } | |
end | |
def cleanup_imagelist(servers) | |
servers.each do |server| | |
server.spot_check_command("rm /root/rightimage_id_list") | |
end | |
end | |
describe "building maverick" do | |
it "should build a maverick RightImage" do | |
RC = "RC2" | |
RIGHTLINK_VERSION="5.6.28" | |
RIGHTLINK_CODE="rightlink_package_5.6.28" # tag to checkout for rightlink build | |
ARCH = "i386" | |
ARCH_NAME = "i386" | |
#ARCH = "x86_64" | |
#ARCH_NAME = "x64" | |
@deploy = Deployment.find 63503 # _by_nickname_speed("build maverick").first | |
servers = @deploy.servers | |
@builder_east = servers.detect {|s| s.nickname =~ /mav-east/} | |
@builder_west = servers.detect {|s| s.nickname =~ /mav-west/} | |
@builder_eu = servers.detect {|s| s.nickname =~ /mav-eu/} | |
@builder_ap_southeast = servers.detect {|s| s.nickname =~ /mav-ap-southeast/} | |
@builder_ap_northeast = servers.detect {|s| s.nickname =~ /mav-ap-northeast/} | |
@cloud_names = { "us-east" => "1", "eu-west" => "2", "us-west" => "3","ap-southeast" => "4", "ap-northeast" => "5"} | |
# @all_builders is in a SPECIFIC ORDER (order of cloud_id) ^^ | |
@all_builders = [ @builder_east, @builder_eu, @builder_west, @builder_ap_southeast, @builder_ap_northeast ] | |
@all_builders.each do |b| | |
b.start | |
b.reload_current | |
b.settings | |
end | |
@all_builders.each do |b| | |
b.wait_for_state("operational") | |
b.parameters # transform! | |
set_params_from_json(b, "base_oss_inputs.js") | |
end | |
set_params_from_json(@builder_east, "east_inputs_oss.js") | |
set_params_from_json(@builder_west, "west_inputs_oss.js") | |
set_params_from_json(@builder_eu, "eu_inputs_oss.js") | |
set_params_from_json(@builder_ap_southeast, "ap_southeast_inputs_oss.js") | |
set_params_from_json(@builder_ap_northeast, "ap_northeast_inputs_oss.js") | |
@all_builders.each do |b| | |
b.parameters # transform! | |
b.parameters["rightimage/rightlink_version"] = "text:#{RIGHTLINK_VERSION}" | |
b.parameters["rightimage/sandbox_repo_tag"] = "text:#{RIGHTLINK_CODE}" | |
b.parameters["rightimage/arch"] = "text:#{ARCH}" | |
b.parameters["rightimage/image_name_override"] = "text:RightImage_OSS_Ubuntu_10.10_Maverick_#{ARCH_NAME}_v#{RIGHTLINK_VERSION}_#{RC}" | |
b.save | |
end | |
#run_recipe(@all_builders, "rightimage::build_image") | |
run_recipe(@all_builders, "rightimage::upload_ec2_s3") | |
run_recipe(@all_builders, "rightimage::upload_ec2_ebs") | |
run_recipe(@all_builders, "rightimage::do_tag_images") | |
run_recipe(@all_builders, "rightimage::do_create_mci") | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment