Rip out context_hosts checks

The remote host is now encoded in the builder name so we don't need
to check it. We'll just do an inspect to confirm the builder exists.
This commit is contained in:
Donal McBreen
2024-06-06 12:43:27 +01:00
committed by Donal McBreen
parent 2aeabda455
commit d6a5cf3c78
7 changed files with 34 additions and 106 deletions

View File

@@ -30,18 +30,9 @@ class Kamal::Cli::Build < Kamal::Cli::Base
say "Building with uncommitted changes:\n #{uncommitted_changes}", :yellow
end
# Get the command here to ensure the Dir.chdir doesn't interfere with it
push = KAMAL.builder.push
run_locally do
begin
context_hosts = capture_with_info(*KAMAL.builder.context_hosts).split("\n")
if context_hosts != KAMAL.builder.config_context_hosts
warn "Context hosts have changed, so re-creating builder, was: #{context_hosts.join(", ")}], now: #{KAMAL.builder.config_context_hosts.join(", ")}"
cli.remove
cli.create
end
execute *KAMAL.builder.buildx_inspect
rescue SSHKit::Command::Failed => e
if e.message =~ /(context not found|no builder|does not exist)/
warn "Missing compatible builder, so creating a new one first"
@@ -51,6 +42,9 @@ class Kamal::Cli::Build < Kamal::Cli::Base
end
end
# Get the command here to ensure the Dir.chdir doesn't interfere with it
push = KAMAL.builder.push
KAMAL.with_verbosity(:debug) do
Dir.chdir(KAMAL.config.builder.build_directory) { execute *push }
end