Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

final 129 does not include postgres job patch #124

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/bosh-cloudfoundry/bosh_release_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ def default_dev_release_name(branch_name=cf_release_branch)
def switch_to_development_release
system_config.release_name = default_dev_release_name(cf_release_branch)
system_config.release_version = "latest"
system_config.release_type = "final"
system_config.release_type = "dev"
system_config.save
end

def switch_to_final_release
system_config.release_name = default_release_name
system_config.release_version = "latest"
system_config.release_type = "dev"
system_config.release_type = "final"
system_config.save
end
end
10 changes: 10 additions & 0 deletions lib/bosh-cloudfoundry/config_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ def base_systems_dir
end
end

# using/uploading a dev release; not a final release
def dev_release_type?
system_config.release_type == "dev"
end

# using/uploading a final release; not a dev release
def final_release_type?
!dev_release_type?
end

def system_initialized?
system_config.system_initialized
end
Expand Down
15 changes: 13 additions & 2 deletions lib/bosh/cli/commands/cf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ def upload_stemcell
option "--final", "Upload latest final release from very latest cf-release commits [default]"
def upload_release
if new_branch = options.delete(:branch)
switch_to_development_release
elsif options.delete(:final)
switch_to_final_release
end
# TODO - default to final release when appcloud-130.yml is released
# switch_to_final_release unless system_config.release_type
switch_to_development_release unless system_config.release_type

if dev_release_type?
new_branch ||= "master"
set_cf_release_branch(new_branch)
clone_or_update_cf_release
prepare_cf_release_for_dev_release
Expand Down Expand Up @@ -277,8 +287,9 @@ def confirm_or_upload_release
elsif options.delete(:final)
switch_to_final_release
end
# default to final release
switch_to_final_release unless system_config.release_type
# TODO - default to final release when appcloud-130.yml is released
# switch_to_final_release unless system_config.release_type
switch_to_development_release unless system_config.release_type

say "Using BOSH release name #{release_name_version} (#{effective_release_version})".green
unless bosh_release_names.include?(release_name)
Expand Down
28 changes: 19 additions & 9 deletions spec/unit/cf_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@
@cmd.system_config.cf_release_branch = "master"
@cmd.system_config.cf_release_branch_dir = File.join(cf_release_dir, "master")
FileUtils.mkdir_p(@cmd.system_config.cf_release_branch_dir)

@cmd.should_receive(:sh).with("git pull origin master")
@cmd.should_receive(:`).with("tail -n 1 releases/index.yml | awk '{print $2}'").and_return("128")
@cmd.should_receive(:sh).with("bosh -n --color upload release releases/appcloud-128.yml")

@cmd.add_option(:final, true)
@cmd.upload_release
end

Expand All @@ -104,8 +106,6 @@
@cmd.system_config.cf_release_branch_dir = File.join(cf_release_dir, "master")
FileUtils.mkdir_p(@cmd.system_config.cf_release_branch_dir)

@cmd.add_option(:branch, "master")

@cmd.should_receive(:sh).with("git pull origin master")
script = <<-BASH.gsub(/^ /, '')
grep -rI "github.com" * .gitmodules | awk 'BEGIN {FS=":"} { print($1) }' | uniq while read file
Expand All @@ -121,6 +121,8 @@
@cmd.should_receive(:write_dev_config_file).with("appcloud-master")
@cmd.should_receive(:sh).with("bosh -n --color create release --with-tarball --force")
@cmd.should_receive(:sh).with("bosh -n --color upload release")

@cmd.add_option(:branch, "master")
@cmd.upload_release
end

Expand All @@ -145,8 +147,14 @@ def generate_new_system(cmd = nil)

if needs_initial_release_uploaded
cmd.should_receive(:bosh_releases).exactly(1).times.and_return([])

# TODO revert to these when appcloud-130 is released; and we go to final release
# cmd.should_receive(:clone_or_update_cf_release)
# cmd.should_receive(:upload_final_release)
cmd.should_receive(:set_cf_release_branch).with("master").exactly(2).times
cmd.should_receive(:clone_or_update_cf_release)
cmd.should_receive(:upload_final_release)
cmd.should_receive(:prepare_cf_release_for_dev_release)
cmd.should_receive(:create_and_upload_dev_release)
else
cmd.should_receive(:bosh_releases).exactly(1).times.and_return([
{"name"=>"appcloud", "versions"=>["124", "126", "129"], "in_use"=>[]},
Expand Down Expand Up @@ -187,11 +195,13 @@ def generate_new_system(cmd = nil)
File.basename(@cmd.system).should == "production"
end

it "uploads latest stemcell & final cf-release by default" do
generate_new_system(@cmd)
File.basename(@cmd.system).should == "production"
@cmd.system_config.release_name.should == "appcloud"
end
# TODO restore when appcloud-130 released
it "uploads latest stemcell & final cf-release by default"
# do
# generate_new_system(@cmd)
# File.basename(@cmd.system).should == "production"
# @cmd.system_config.release_name.should == "appcloud"
# end

it "new system has common random password" do
generate_new_system(@cmd)
Expand Down