Make building from a git archive the default

If no context is specified and we are in a git repo, then we'll build
from a git archive by default. This means we don't need a separate
setting and gives us a safer default build.
This commit is contained in:
Donal McBreen
2024-03-06 08:37:23 +00:00
parent f3b7569032
commit 53bfefeb2f
6 changed files with 32 additions and 34 deletions

View File

@@ -86,7 +86,7 @@ class Kamal::Configuration::Builder
end
def git_archive?
@options["git_archive"]
Kamal::Git.used? && @options["context"].nil?
end
private
@@ -94,9 +94,6 @@ class Kamal::Configuration::Builder
if @options["cache"] && @options["cache"]["type"]
raise ArgumentError, "Invalid cache type: #{@options["cache"]["type"]}" unless [ "gha", "registry" ].include?(@options["cache"]["type"])
end
if @options["context"] && @options["git_archive"]
raise ArgumentError, "Cannot set a builder context when building from a git archive"
end
end
def cache_image