|
|
|
|
@@ -8,25 +8,25 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
|
|
|
|
test "target multiarch by default" do
|
|
|
|
|
builder = new_builder_command
|
|
|
|
|
assert_equal "multiarch", builder.name
|
|
|
|
|
assert_equal [:docker, :buildx, :build, "--push", "--platform", "linux/amd64,linux/arm64", "--builder", "mrsk-app-multiarch", "-t", "dhh/app:123", "."], builder.push
|
|
|
|
|
assert_equal [:docker, :buildx, :build, "--push", "--platform", "linux/amd64,linux/arm64", "--builder", "mrsk-app-multiarch", "-t", "dhh/app:123", "-t", "dhh/app:latest", "."], builder.push
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "target native when multiarch is off" do
|
|
|
|
|
builder = new_builder_command(builder: { "multiarch" => false })
|
|
|
|
|
assert_equal "native", builder.name
|
|
|
|
|
assert_equal [:docker, :build, "-t", "dhh/app:123", ".", "&&", :docker, :push, "dhh/app:123"], builder.push
|
|
|
|
|
assert_equal [:docker, :build, "-t", "dhh/app:123", "-t", "dhh/app:latest", ".", "&&", :docker, :push, "dhh/app:123"], builder.push
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "target multiarch remote when local and remote is set" do
|
|
|
|
|
builder = new_builder_command(builder: { "local" => { }, "remote" => { } })
|
|
|
|
|
assert_equal "multiarch/remote", builder.name
|
|
|
|
|
assert_equal [:docker, :buildx, :build, "--push", "--platform", "linux/amd64,linux/arm64", "--builder", "mrsk-app-multiarch-remote", "-t", "dhh/app:123", "."], builder.push
|
|
|
|
|
assert_equal [:docker, :buildx, :build, "--push", "--platform", "linux/amd64,linux/arm64", "--builder", "mrsk-app-multiarch-remote", "-t", "dhh/app:123", "-t", "dhh/app:latest", "."], builder.push
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "target native remote when only remote is set" do
|
|
|
|
|
builder = new_builder_command(builder: { "remote" => { "arch" => "amd64" } })
|
|
|
|
|
assert_equal "native/remote", builder.name
|
|
|
|
|
assert_equal [:docker, :buildx, :build, "--push", "--platform", "linux/amd64", "--builder", "mrsk-app-native-remote", "-t", "dhh/app:123", "."], builder.push
|
|
|
|
|
assert_equal [:docker, :buildx, :build, "--push", "--platform", "linux/amd64", "--builder", "mrsk-app-native-remote", "-t", "dhh/app:123", "-t", "dhh/app:latest", "."], builder.push
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "build args" do
|
|
|
|
|
@@ -41,17 +41,17 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
|
|
|
|
|
|
|
|
|
test "native push with build args" do
|
|
|
|
|
builder = new_builder_command(builder: { "multiarch" => false, "args" => { "a" => 1, "b" => 2 } })
|
|
|
|
|
assert_equal [ :docker, :build, "-t", "dhh/app:123", "--build-arg", "a=1", "--build-arg", "b=2", ".", "&&", :docker, :push, "dhh/app:123" ], builder.push
|
|
|
|
|
assert_equal [ :docker, :build, "-t", "dhh/app:123", "-t", "dhh/app:latest", "--build-arg", "a=1", "--build-arg", "b=2", ".", "&&", :docker, :push, "dhh/app:123" ], builder.push
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "multiarch push with build args" do
|
|
|
|
|
builder = new_builder_command(builder: { "args" => { "a" => 1, "b" => 2 } })
|
|
|
|
|
assert_equal [ :docker, :buildx, :build, "--push", "--platform", "linux/amd64,linux/arm64", "--builder", "mrsk-app-multiarch", "-t", "dhh/app:123", "--build-arg", "a=1", "--build-arg", "b=2", "." ], builder.push
|
|
|
|
|
assert_equal [ :docker, :buildx, :build, "--push", "--platform", "linux/amd64,linux/arm64", "--builder", "mrsk-app-multiarch", "-t", "dhh/app:123", "-t", "dhh/app:latest", "--build-arg", "a=1", "--build-arg", "b=2", "." ], builder.push
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "native push with with build secrets" do
|
|
|
|
|
builder = new_builder_command(builder: { "multiarch" => false, "secrets" => [ "a", "b" ] })
|
|
|
|
|
assert_equal [ :docker, :build, "-t", "dhh/app:123", "--secret", "id=a", "--secret", "id=b", ".", "&&", :docker, :push, "dhh/app:123" ], builder.push
|
|
|
|
|
assert_equal [ :docker, :build, "-t", "dhh/app:123", "-t", "dhh/app:latest", "--secret", "id=a", "--secret", "id=b", ".", "&&", :docker, :push, "dhh/app:123" ], builder.push
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|