More code style improvements

This commit is contained in:
Igor Alexandrov
2023-06-19 18:22:07 +04:00
parent dadd8225da
commit 02256ac8fe
2 changed files with 11 additions and 17 deletions

View File

@@ -13,4 +13,4 @@ class Mrsk::Commands::Builder::Native::Cached < Mrsk::Commands::Builder::Native
*build_options, *build_options,
build_context build_context
end end
end end

View File

@@ -62,9 +62,9 @@ class Mrsk::Configuration::Builder
def cache_from def cache_from
if cached? if cached?
case @options["cache"]["type"] case @options["cache"]["type"]
when 'gha' when "gha"
"type=gha" cache_from_config_for_gha
when 'registry' when "registry"
cache_from_config_for_registry cache_from_config_for_registry
end end
end end
@@ -96,25 +96,19 @@ class Mrsk::Configuration::Builder
@options["cache"]&.fetch("image", nil) || "#{@image}-build-cache" @options["cache"]&.fetch("image", nil) || "#{@image}-build-cache"
end end
def cache_from_config_for_gha
"type=gha"
end
def cache_from_config_for_registry def cache_from_config_for_registry
[ [ "type=registry", "ref=#{@server}/#{cache_image}" ].compact.join(",")
"type=registry",
"ref=#{@server}/#{cache_image}"
].compact.join(",")
end end
def cache_to_config_for_gha def cache_to_config_for_gha
[ [ "type=gha", @options["cache"]&.fetch("options", nil)].compact.join(",")
"type=gha",
@options["cache"]&.fetch("options", nil),
].compact.join(",")
end end
def cache_to_config_for_registry def cache_to_config_for_registry
[ [ "type=registry", @options["cache"]&.fetch("options", nil), "ref=#{@server}/#{cache_image}" ].compact.join(",")
"type=registry",
@options["cache"]&.fetch("options", nil),
"ref=#{@server}/#{cache_image}"
].compact.join(",")
end end
end end