Class: Dependabot::Docker::FileUpdater

Inherits:
Shared::SharedFileUpdater show all
Extended by:
T::Sig
Defined in:
lib/dependabot/docker/file_updater.rb

Constant Summary collapse

YAML_REGEXP =
/^[^\.].*\.ya?ml$/i
FROM_REGEX =
/FROM(\s+--platform\=\S+)?/i

Constants inherited from Shared::SharedFileUpdater

Shared::SharedFileUpdater::ImageSource

Instance Method Summary collapse

Methods inherited from Shared::SharedFileUpdater

#updated_dependency_files

Instance Method Details

#container_image_regexObject



29
30
31
# File 'lib/dependabot/docker/file_updater.rb', line 29

def container_image_regex
  %r{^#{FROM_REGEX}\s+(docker\.io/)?}o
end

#file_typeObject



19
20
21
# File 'lib/dependabot/docker/file_updater.rb', line 19

def file_type
  "Dockerfile or Containerfile"
end

#noticesObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dependabot/docker/file_updater.rb', line 34

def notices
  return [] unless dependencies.any? { |dependency| dependency.[:docker_cooldown_date_unavailable] }

  [Dependabot::Notice.new(
    mode: Dependabot::Notice::NoticeMode::WARN,
    type: "docker_cooldown_date_unavailable",
    package_manager_name: "docker",
    title: "Docker cooldown was not applied",
    description: "Cooldown could not be applied because no publication date was available from the registry.",
    show_in_pr: true,
    show_alert: false
  )]
end

#yaml_file_patternObject



24
25
26
# File 'lib/dependabot/docker/file_updater.rb', line 24

def yaml_file_pattern
  YAML_REGEXP
end