Skip to content

Commit 5dd8eba

Browse files
authored
Merge pull request #1611 from flavorjones/flavorjones/remote-builder-check
`Builder::Remote.inspect_builder` requires both checks to pass
2 parents 4b88852 + 8e470ed commit 5dd8eba

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/kamal/commands/builder/remote.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def info
1919

2020
def inspect_builder
2121
combine \
22-
combine inspect_buildx, inspect_remote_context,
22+
combine(inspect_buildx, inspect_remote_context),
2323
[ "(echo no compatible builder && exit 1)" ],
2424
by: "||"
2525
end

test/cli/build_test.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ class CliBuildTest < CliTestCase
3131
end
3232
end
3333

34+
test "push with remote builder checks both the builder and the remote context" do
35+
with_build_directory do |build_directory|
36+
Kamal::Commands::Hook.any_instance.stubs(:hook_exists?).returns(true)
37+
38+
SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info)
39+
.with(:git, "-C", anything, :"rev-parse", :HEAD)
40+
.returns(Kamal::Git.revision)
41+
42+
SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info)
43+
.with(:git, "-C", anything, :status, "--porcelain")
44+
.returns("")
45+
46+
run_command("push", "--verbose", fixture: :with_remote_builder).tap do |output|
47+
assert_match "docker buildx inspect kamal-remote-ssh---app-1-1-1-5 | grep -q Endpoint:.*kamal-remote-ssh---app-1-1-1-5-context && docker context inspect kamal-remote-ssh---app-1-1-1-5-context --format '{{.Endpoints.docker.Host}}' | grep -xq ssh://[email protected] || (echo no compatible builder && exit 1)", output
48+
end
49+
end
50+
end
51+
3452
test "push --output=docker" do
3553
with_build_directory do |build_directory|
3654
Kamal::Commands::Hook.any_instance.stubs(:hook_exists?).returns(true)

0 commit comments

Comments
 (0)