Fixup rebase issues
This commit is contained in:
@@ -82,17 +82,19 @@ class Mrsk::Cli::Main < Mrsk::Cli::Base
|
|||||||
with_lock do
|
with_lock do
|
||||||
invoke_options = deploy_options
|
invoke_options = deploy_options
|
||||||
|
|
||||||
MRSK.config.version = version
|
MRSK.config.version = version
|
||||||
old_version = nil
|
old_version = nil
|
||||||
|
|
||||||
if container_available?(version)
|
if container_available?(version)
|
||||||
invoke "mrsk:cli:app:boot", [], invoke_options.merge(version: version)
|
invoke "mrsk:cli:app:boot", [], invoke_options.merge(version: version)
|
||||||
|
rolled_back = true
|
||||||
run_hook "post-deploy", runtime: runtime.round
|
else
|
||||||
else
|
say "The app version '#{version}' is not available as a container (use 'mrsk app containers' for available versions)", :red
|
||||||
say "The app version '#{version}' is not available as a container (use 'mrsk app containers' for available versions)", :red
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
run_hook "post-deploy", runtime: runtime.round if rolled_back
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "details", "Show details about all containers"
|
desc "details", "Show details about all containers"
|
||||||
|
|||||||
@@ -83,23 +83,6 @@ class CliMainTest < CliTestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deploy errors during critical section leave lock in place" do
|
|
||||||
invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999" }
|
|
||||||
|
|
||||||
Mrsk::Cli::Main.any_instance.expects(:invoke).with("mrsk:cli:registry:login", [], invoke_options)
|
|
||||||
Mrsk::Cli::Main.any_instance.expects(:invoke).with("mrsk:cli:build:deliver", [], invoke_options)
|
|
||||||
Mrsk::Cli::Main.any_instance.expects(:invoke).with("mrsk:cli:app:stale_containers", [], invoke_options)
|
|
||||||
Mrsk::Cli::Main.any_instance.expects(:invoke).with("mrsk:cli:traefik:boot", [], invoke_options)
|
|
||||||
Mrsk::Cli::Main.any_instance.expects(:invoke).with("mrsk:cli:healthcheck:perform", [], invoke_options)
|
|
||||||
Mrsk::Cli::Main.any_instance.expects(:invoke).with("mrsk:cli:app:boot", [], invoke_options).raises(RuntimeError)
|
|
||||||
|
|
||||||
assert !MRSK.holding_lock?
|
|
||||||
assert_raises(RuntimeError) do
|
|
||||||
stderred { run_command("deploy") }
|
|
||||||
end
|
|
||||||
assert MRSK.holding_lock?
|
|
||||||
end
|
|
||||||
|
|
||||||
test "deploy errors during outside section leave remove lock" do
|
test "deploy errors during outside section leave remove lock" do
|
||||||
invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999" }
|
invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999" }
|
||||||
|
|
||||||
@@ -205,7 +188,20 @@ class CliMainTest < CliTestCase
|
|||||||
test "rollback runs post deploy hook" do
|
test "rollback runs post deploy hook" do
|
||||||
Mrsk::Cli::Main.any_instance.stubs(:container_available?).returns(true)
|
Mrsk::Cli::Main.any_instance.stubs(:container_available?).returns(true)
|
||||||
|
|
||||||
|
Mrsk::Utils::HealthcheckPoller.stubs(:sleep)
|
||||||
|
|
||||||
|
SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info)
|
||||||
|
.with(:docker, :container, :ls, "--filter", "name=^app-web-123$", "--quiet", raise_on_non_zero_exit: false)
|
||||||
|
.returns("").at_least_once
|
||||||
|
SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info)
|
||||||
|
.with(:docker, :ps, "--filter", "label=service=app", "--filter", "label=role=web", "--filter", "status=running", "--latest", "--format", "\"{{.Names}}\"", "|", "grep -oE \"\\-[^-]+$\"", "|", "cut -c 2-", raise_on_non_zero_exit: false)
|
||||||
|
.returns("").at_least_once
|
||||||
|
SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info)
|
||||||
|
.with(:docker, :container, :ls, "--all", "--filter", "name=^app-web-123$", "--quiet", "|", :xargs, :docker, :inspect, "--format", "'{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}'")
|
||||||
|
.returns("running").at_least_once # health check
|
||||||
|
|
||||||
ensure_hook_runs("post-deploy")
|
ensure_hook_runs("post-deploy")
|
||||||
|
|
||||||
run_command("rollback", "123")
|
run_command("rollback", "123")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user