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

@@ -103,17 +103,17 @@ class ConfigurationTest < ActiveSupport::TestCase
Kamal::Git.expects(:revision).returns("git-version")
Kamal::Git.expects(:uncommitted_changes).returns("M file\n")
assert_match /^git-version_uncommitted_[0-9a-f]{16}$/, @config.version
assert_equal "git-version", @config.version
end
test "version from git archive uncommitted" do
test "version from uncommitted context" do
ENV.delete("VERSION")
config = Kamal::Configuration.new(@deploy.tap { |c| c[:builder] = { "git_archive" => true } })
config = Kamal::Configuration.new(@deploy.tap { |c| c[:builder] = { "context" => "." } })
Kamal::Git.expects(:revision).returns("git-version")
Kamal::Git.expects(:uncommitted_changes).returns("M file\n")
assert_equal "git-version", config.version
assert_match /^git-version_uncommitted_[0-9a-f]{16}$/, config.version
end
test "version from env" do