Further distinguish dependency verification
This commit is contained in:
@@ -16,7 +16,7 @@ class Mrsk::Cli::Build < Mrsk::Cli::Base
|
|||||||
|
|
||||||
run_locally do
|
run_locally do
|
||||||
begin
|
begin
|
||||||
if cli.verify_dependencies
|
if cli.verify_local_dependencies
|
||||||
MRSK.with_verbosity(:debug) { execute *MRSK.builder.push }
|
MRSK.with_verbosity(:debug) { execute *MRSK.builder.push }
|
||||||
end
|
end
|
||||||
rescue SSHKit::Command::Failed => e
|
rescue SSHKit::Command::Failed => e
|
||||||
@@ -84,7 +84,7 @@ class Mrsk::Cli::Build < Mrsk::Cli::Base
|
|||||||
|
|
||||||
|
|
||||||
desc "", "" # Really a private method, but needed to be invoked from #push
|
desc "", "" # Really a private method, but needed to be invoked from #push
|
||||||
def verify_dependencies
|
def verify_local_dependencies
|
||||||
run_locally do
|
run_locally do
|
||||||
begin
|
begin
|
||||||
execute *MRSK.builder.ensure_local_dependencies_installed
|
execute *MRSK.builder.ensure_local_dependencies_installed
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class CliBuildTest < CliTestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "push" do
|
test "push" do
|
||||||
Mrsk::Cli::Build.any_instance.stubs(:verify_dependencies).returns(true)
|
Mrsk::Cli::Build.any_instance.stubs(:verify_local_dependencies).returns(true)
|
||||||
run_command("push").tap do |output|
|
run_command("push").tap do |output|
|
||||||
assert_match /docker buildx build --push --platform linux\/amd64,linux\/arm64 --builder mrsk-app-multiarch -t dhh\/app:999 -t dhh\/app:latest --label service="app" --file Dockerfile \. as .*@localhost/, output
|
assert_match /docker buildx build --push --platform linux\/amd64,linux\/arm64 --builder mrsk-app-multiarch -t dhh\/app:999 -t dhh\/app:latest --label service="app" --file Dockerfile \. as .*@localhost/, output
|
||||||
end
|
end
|
||||||
@@ -17,7 +17,7 @@ class CliBuildTest < CliTestCase
|
|||||||
|
|
||||||
test "push without builder" do
|
test "push without builder" do
|
||||||
stub_locking
|
stub_locking
|
||||||
Mrsk::Cli::Build.any_instance.stubs(:verify_dependencies).returns(true)
|
Mrsk::Cli::Build.any_instance.stubs(:verify_local_dependencies).returns(true)
|
||||||
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
|
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
|
||||||
.with { |arg| arg == :docker }
|
.with { |arg| arg == :docker }
|
||||||
.raises(SSHKit::Command::Failed.new("no builder"))
|
.raises(SSHKit::Command::Failed.new("no builder"))
|
||||||
@@ -73,7 +73,7 @@ class CliBuildTest < CliTestCase
|
|||||||
test "verify local dependencies" do
|
test "verify local dependencies" do
|
||||||
Mrsk::Commands::Builder.any_instance.stubs(:name).returns("remote".inquiry)
|
Mrsk::Commands::Builder.any_instance.stubs(:name).returns("remote".inquiry)
|
||||||
|
|
||||||
run_command("verify_dependencies").tap do |output|
|
run_command("verify_local_dependencies").tap do |output|
|
||||||
assert_match /docker --version && docker buildx version/, output
|
assert_match /docker --version && docker buildx version/, output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -84,7 +84,7 @@ class CliBuildTest < CliTestCase
|
|||||||
.raises(SSHKit::Command::Failed.new("no buildx"))
|
.raises(SSHKit::Command::Failed.new("no buildx"))
|
||||||
|
|
||||||
Mrsk::Commands::Builder.any_instance.stubs(:native_and_local?).returns(false)
|
Mrsk::Commands::Builder.any_instance.stubs(:native_and_local?).returns(false)
|
||||||
assert_raises(Mrsk::Cli::Build::BuildError) { run_command("verify_dependencies") }
|
assert_raises(Mrsk::Cli::Build::BuildError) { run_command("verify_local_dependencies") }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Reference in New Issue
Block a user