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

@@ -31,7 +31,6 @@ registry:
# user: app
# Configure builder setup.
# Set git_archive: true to build from a git archive of HEAD
# builder:
# args:
# RUBY_VERSION: 3.2.0
@@ -40,7 +39,6 @@ registry:
# remote:
# arch: amd64
# host: ssh://app@192.168.0.1
# git_archive: false
# Use accessory services (secrets come from .env).
# accessories:

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