Add absolute_image to account for custom registry
This commit is contained in:
@@ -24,6 +24,10 @@ class Mrsk::Configuration
|
|||||||
@version ||= ENV["VERSION"] || `git rev-parse HEAD`.strip
|
@version ||= ENV["VERSION"] || `git rev-parse HEAD`.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def absolute_image
|
||||||
|
[ config.registry["server"], image ].compact.join("/")
|
||||||
|
end
|
||||||
|
|
||||||
def image_with_version
|
def image_with_version
|
||||||
"#{image}:#{version}"
|
"#{image}:#{version}"
|
||||||
end
|
end
|
||||||
|
|||||||
16
test/configuration_test.rb
Normal file
16
test/configuration_test.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
require "test_helper"
|
||||||
|
require "mrsk/configuration"
|
||||||
|
|
||||||
|
class ConfigurationTest < ActiveSupport::TestCase
|
||||||
|
setup do
|
||||||
|
@config = { service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" } }
|
||||||
|
end
|
||||||
|
|
||||||
|
test "absolute image" do
|
||||||
|
configuration = Mrsk::Configuration.new(@config)
|
||||||
|
assert_equal "dhh/app", configuration.absolute_image
|
||||||
|
|
||||||
|
configuration = Mrsk::Configuration.new(@config.tap { |c| c[:registry].merge!({ "server" => "ghcr.io" }) })
|
||||||
|
assert_equal "ghcr.io/dhh/app", configuration.absolute_image
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user