Split out repository to be used alone
This commit is contained in:
@@ -25,8 +25,12 @@ class Mrsk::Configuration
|
||||
@version ||= ENV["VERSION"] || `git rev-parse HEAD`.strip
|
||||
end
|
||||
|
||||
def repository
|
||||
[ config.registry["server"], image ].compact.join("/")
|
||||
end
|
||||
|
||||
def absolute_image
|
||||
[ config.registry["server"], "#{image}:#{version}" ].compact.join("/")
|
||||
"#{repository}:#{version}"
|
||||
end
|
||||
|
||||
def service_with_version
|
||||
|
||||
@@ -19,6 +19,14 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "repository" do
|
||||
configuration = Mrsk::Configuration.new(@config)
|
||||
assert_equal "dhh/app", configuration.repository
|
||||
|
||||
configuration = Mrsk::Configuration.new(@config.tap { |c| c[:registry].merge!({ "server" => "ghcr.io" }) })
|
||||
assert_equal "ghcr.io/dhh/app", configuration.repository
|
||||
end
|
||||
|
||||
test "absolute image" do
|
||||
configuration = Mrsk::Configuration.new(@config)
|
||||
assert_equal "dhh/app:123", configuration.absolute_image
|
||||
|
||||
Reference in New Issue
Block a user