Enable docker secrets in the builder as a more secure alternative to build args.

This commit is contained in:
Nathan Anderson
2023-01-18 17:35:36 -05:00
parent 84597e2fcd
commit e516f427cd
4 changed files with 44 additions and 2 deletions

View File

@@ -27,6 +27,11 @@ class CommandsBuilderTest < ActiveSupport::TestCase
assert_equal [ "--build-arg", "a=1", "--build-arg", "b=2" ], builder.target.build_args
end
test "build secrets" do
builder = Mrsk::Commands::Builder.new(Mrsk::Configuration.new(@config.merge({ builder: { "secrets" => ["token_a", "token_b"] } })))
assert_equal [ "--secret", "id=token_a", "--secret", "id=token_b" ], builder.target.build_secrets
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-arg", "a=1", "--build-arg", "b=2", "dhh/app:123", ".", "&&", :docker, :push, "dhh/app:123" ], builder.push