From abc8cdce8ad1687613aa729b66706dcc341fc8a9 Mon Sep 17 00:00:00 2001 From: fabiosammy Date: Wed, 5 Jun 2024 00:02:31 -0300 Subject: [PATCH] When we call the kamal with remote only set(no local) + multiarch disabled, it calls the native builder instead of remote builder --- lib/kamal/commands/builder.rb | 6 +++--- test/commands/builder_test.rb | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/kamal/commands/builder.rb b/lib/kamal/commands/builder.rb index 2e5862a8..2c6b17d0 100644 --- a/lib/kamal/commands/builder.rb +++ b/lib/kamal/commands/builder.rb @@ -11,11 +11,11 @@ def name def target case - when !config.builder.multiarch? && !config.builder.cached? + when !config.builder.multiarch? && !config.builder.cached? && !config.builder.remote? native - when !config.builder.multiarch? && config.builder.cached? + when !config.builder.multiarch? && config.builder.cached? && !config.builder.remote? native_cached - when config.builder.local? && config.builder.remote? + when config.builder.multiarch? && config.builder.local? && config.builder.remote? multiarch_remote when config.builder.remote? native_remote diff --git a/test/commands/builder_test.rb b/test/commands/builder_test.rb index 064454a2..63204fff 100644 --- a/test/commands/builder_test.rb +++ b/test/commands/builder_test.rb @@ -53,6 +53,14 @@ class CommandsBuilderTest < ActiveSupport::TestCase builder.push.join(" ") end + test "target native remote when multiarch is disabled and remote is set" do + builder = new_builder_command(builder: { "multiarch" => false, "remote" => { "arch" => "amd64" } }) + assert_equal "native/remote", builder.name + assert_equal \ + "docker buildx build --push --platform linux/amd64 --builder kamal-app-native-remote -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --file Dockerfile .", + builder.push.join(" ") + end + test "build args" do builder = new_builder_command(builder: { "args" => { "a" => 1, "b" => 2 } }) assert_equal \