Class: Dependabot::Helm::FileUpdater::ImageUpdater

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/dependabot/helm/file_updater/image_updater.rb

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, dependency_files:) ⇒ ImageUpdater

Returns a new instance of ImageUpdater.



17
18
19
20
# File 'lib/dependabot/helm/file_updater/image_updater.rb', line 17

def initialize(dependency:, dependency_files:)
  @dependency_files = dependency_files
  @dependency = dependency
end

Instance Method Details

#updated_values_yaml_content(file_name) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/dependabot/helm/file_updater/image_updater.rb', line 23

def updated_values_yaml_content(file_name)
  value_file = dependency_files.find { |f| f.name.match?(file_name) }
  raise "Expected a values.yaml file to exist!" if value_file.nil?

  content = value_file.content
  yaml_stream = YAML.parse_stream(T.must(content))

  update_image_tags_recursive(yaml_stream, T.must(content))
end