Config the number of containers to keep
By default we keep 5 containers around for rollback. The containers don't take much space, but the images for them can. Make the number of containers to retain configurable, either in the config with the `retain_containers` setting on the command line with the `--retain` option.
This commit is contained in:
@@ -299,7 +299,7 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
|
||||
assert_equal "alternate_web", config.primary_role
|
||||
assert_equal "1.1.1.4", config.primary_host
|
||||
assert config.role(:alternate_web).primary?
|
||||
assert config.role(:alternate_web).primary?
|
||||
assert config.role(:alternate_web).running_traefik?
|
||||
end
|
||||
|
||||
@@ -309,4 +309,12 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
end
|
||||
assert_match /bar isn't defined/, error.message
|
||||
end
|
||||
|
||||
test "retain_containers" do
|
||||
assert_equal 5, @config.retain_containers
|
||||
config = Kamal::Configuration.new(@deploy_with_roles.merge(retain_containers: 2))
|
||||
assert_equal 2, config.retain_containers
|
||||
|
||||
assert_raises(ArgumentError) { Kamal::Configuration.new(@deploy_with_roles.merge(retain_containers: 0)) }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user