lib/hako/definition_loader.rb in hako-2.7.0 vs lib/hako/definition_loader.rb in hako-2.8.0
- old
+ new
@@ -12,14 +12,14 @@
def initialize(app, dry_run:)
@app = app
@dry_run = dry_run
end
- # @param [String] tag
+ # @param [String, nil] tag
# @param [Array<String>, nil] with
# @return [Hash<String, Container>]
- def load(tag, with: nil)
+ def load(tag: nil, with: nil)
# XXX: Load additional_containers for compatibility
sidecars = @app.definition.fetch('sidecars', @app.definition.fetch('additional_containers', {}))
container_names = ['app']
if with
container_names.concat(with)
@@ -30,11 +30,11 @@
load_containers_from_name(tag, container_names, sidecars)
end
private
- # @param [String] tag
+ # @param [String, nil] tag
# @param [Array<String>] container_names
# @param [Hash<String, Hash>] sidecars
# @return [Hash<String, Container>]
def load_containers_from_name(tag, container_names, sidecars)
names = Set.new(container_names)
@@ -42,10 +42,11 @@
while containers.size < names.size
names.difference(containers.keys).each do |name|
containers[name] =
case name
when 'app'
- AppContainer.new(@app, @app.definition['app'].merge('tag' => tag), dry_run: @dry_run)
+ @app.definition['app']['tag'] = tag if tag
+ AppContainer.new(@app, @app.definition['app'], dry_run: @dry_run)
else
Container.new(@app, sidecars.fetch(name), dry_run: @dry_run)
end
containers[name].links.each do |link|