Add build args

This commit is contained in:
David Heinemeier Hansson
2023-01-15 10:35:15 +01:00
parent 53cd13a0fa
commit bafbde52fe
6 changed files with 64 additions and 19 deletions

View File

@@ -21,4 +21,19 @@ class BuilderCommandTest < ActiveSupport::TestCase
builder = Mrsk::Commands::Builder.new(Mrsk::Configuration.new(@config.merge({ builder: { "local" => { }, "remote" => { } } })))
assert builder.remote?
end
test "build args" do
builder = Mrsk::Commands::Builder.new(Mrsk::Configuration.new(@config.merge({ builder: { "args" => { "a" => 1, "b" => 2 } } })))
assert_equal [ "--build-args", "a=1", "--build-args", "b=2" ], builder.target.build_args
end
test "native push with build args" do
builder = Mrsk::Commands::Builder.new(Mrsk::Configuration.new(@config.merge({ builder: { "multiarch" => false, "args" => { "a" => 1, "b" => 2 } } })))
assert_equal [ :docker, :build, "-t", "--build-args", "a=1", "--build-args", "b=2", "dhh/app:123", ".", "&&", :docker, :push, "dhh/app:123" ], builder.push
end
test "multiarch push with build args" do
builder = Mrsk::Commands::Builder.new(Mrsk::Configuration.new(@config.merge({ builder: { "args" => { "a" => 1, "b" => 2 } } })))
assert_equal [ :docker, :buildx, :build, "--push", "--platform linux/amd64,linux/arm64", "-t", "dhh/app:123", "--build-args", "a=1", "--build-args", "b=2", "." ], builder.push
end
end