Compare commits

...

7 Commits

Author SHA1 Message Date
Donal McBreen
3c8428504d Bump version for 1.5.2 2024-05-07 09:44:11 +01:00
Donal McBreen
8e71c48747 Merge pull request #759 from basecamp/details-accessory-host
Output the host when running accessory details
2024-05-02 15:54:08 +01:00
Donal McBreen
67a86e1068 Merge pull request #790 from basecamp/warn-on-missing-builder
Warn on missing builder
2024-05-02 12:50:00 +01:00
Donal McBreen
b67f40bdf7 Warn on missing builder
We are going to try to create a builder if one is missing, so let's warn
rather than report it as an error.
2024-05-02 12:38:20 +01:00
Donal McBreen
375f0283c4 Merge pull request #785 from basecamp/filter-traefik-hosts
Apply --hosts and --roles filters to traefik hosts as well
2024-04-29 14:48:23 +01:00
Matthew Kent
b8aaddb4c9 Apply --hosts and --roles filters to traefik hosts as well. 2024-04-26 17:08:57 -07:00
Donal McBreen
e6d436f646 Output the host when running accessory details
We already do this for app and Traefik hosts.
2024-04-05 12:46:51 +01:00
9 changed files with 36 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
PATH
remote: .
specs:
kamal (1.5.1)
kamal (1.5.2)
activesupport (>= 7.0)
base64 (~> 0.2)
bcrypt_pbkdf (~> 1.0)

View File

@@ -107,8 +107,9 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
if name == "all"
KAMAL.accessory_names.each { |accessory_name| details(accessory_name) }
else
type = "Accessory #{name}"
with_accessory(name) do |accessory, hosts|
on(hosts) { puts capture_with_info(*accessory.info) }
on(hosts) { puts_by_host host, capture_with_info(*accessory.info), type: type }
end
end
end

View File

@@ -30,7 +30,7 @@ class Kamal::Cli::Build < Kamal::Cli::Base
end
rescue SSHKit::Command::Failed => e
if e.message =~ /(no builder)|(no such file or directory)/
error "Missing compatible builder, so creating a new one first"
warn "Missing compatible builder, so creating a new one first"
if cli.create
KAMAL.with_verbosity(:debug) { execute *KAMAL.builder.push }

View File

@@ -19,7 +19,7 @@ class Kamal::Commander::Specifics
end
def traefik_hosts
specific_hosts || config.traefik_hosts
config.traefik_hosts & specified_hosts
end
def accessory_hosts

View File

@@ -1,3 +1,3 @@
module Kamal
VERSION = "1.5.1"
VERSION = "1.5.2"
end

View File

@@ -76,7 +76,10 @@ class CliAccessoryTest < CliTestCase
end
test "details" do
assert_match "docker ps --filter label=service=app-mysql", run_command("details", "mysql")
run_command("details", "mysql").tap do |output|
assert_match "docker ps --filter label=service=app-mysql", output
assert_match "Accessory mysql Host: 1.1.1.3", output
end
end
test "details with non-existent accessory" do
@@ -85,6 +88,8 @@ class CliAccessoryTest < CliTestCase
test "details with all" do
run_command("details", "all").tap do |output|
assert_match "Accessory mysql Host: 1.1.1.3", output
assert_match "Accessory redis Host: 1.1.1.2", output
assert_match "docker ps --filter label=service=app-mysql", output
assert_match "docker ps --filter label=service=app-redis", output
end

View File

@@ -34,7 +34,7 @@ class CliBuildTest < CliTestCase
.returns(true)
run_command("push").tap do |output|
assert_match /Missing compatible builder, so creating a new one first/, output
assert_match /WARN Missing compatible builder, so creating a new one first/, output
end
end

View File

@@ -131,6 +131,20 @@ class CommanderTest < ActiveSupport::TestCase
assert_equal [ "1.1.1.3", "1.1.1.4", "1.1.1.1", "1.1.1.2" ], @kamal.hosts
end
test "traefik hosts should observe filtered roles" do
configure_with(:deploy_with_aliases)
@kamal.specific_roles = [ "web_tokyo" ]
assert_equal [ "1.1.1.3", "1.1.1.4" ], @kamal.traefik_hosts
end
test "traefik hosts should observe filtered hosts" do
configure_with(:deploy_with_aliases)
@kamal.specific_hosts = [ "1.1.1.4" ]
assert_equal [ "1.1.1.4" ], @kamal.traefik_hosts
end
private
def configure_with(variant)
@kamal = Kamal::Commander.new.tap do |kamal|

View File

@@ -83,6 +83,15 @@ class ConfigurationTest < ActiveSupport::TestCase
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3" ], config.traefik_hosts
end
test "filtered traefik hosts" do
assert_equal [ "1.1.1.1", "1.1.1.2" ], @config_with_roles.traefik_hosts
@deploy_with_roles[:servers]["workers"]["traefik"] = true
config = Kamal::Configuration.new(@deploy_with_roles)
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3" ], config.traefik_hosts
end
test "version no git repo" do
ENV.delete("VERSION")