Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/lib/dependabot/docker/file_fetcher.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require "dependabot/docker/utils/helpers"
require "dependabot/experiments"
require "dependabot/file_fetchers"
require "dependabot/file_fetchers/base"
Expand All @@ -9,7 +10,6 @@ module Docker
class FileFetcher < Dependabot::FileFetchers::Base
YAML_REGEXP = /^[^\.]+\.ya?ml$/i
DOCKER_REGEXP = /dockerfile/i
HELM_REGEXP = /values[\-a-zA-Z_0-9]*\.ya?ml$/i

def self.required_files_in?(filenames)
filenames.any? { |f| f.match?(DOCKER_REGEXP) } or
Expand Down Expand Up @@ -86,7 +86,7 @@ def likely_kubernetes_resource?(resource)
def correctly_encoded_yamlfiles
candidate_files = yamlfiles.select { |f| f.content.valid_encoding? }
candidate_files.select do |f|
if f.type == "file" && f.name.match?(HELM_REGEXP)
if f.type == "file" && Utils.likely_helm_chart?(f)
true
else
# This doesn't handle multi-resource files, but it shouldn't matter, since the first resource
Expand Down
3 changes: 2 additions & 1 deletion docker/lib/dependabot/docker/file_updater.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require "dependabot/docker/utils/helpers"
require "dependabot/file_updaters"
require "dependabot/file_updaters/base"
require "dependabot/errors"
Expand Down Expand Up @@ -152,7 +153,7 @@ def private_registry_url(file)
end

def updated_yaml_content(file)
updated_content = file.name == "values.yaml" ? update_helm(file) : update_image(file)
updated_content = Utils.likely_helm_chart?(file) ? update_helm(file) : update_image(file)

raise "Expected content to change!" if updated_content == file.content

Expand Down
13 changes: 13 additions & 0 deletions docker/lib/dependabot/docker/utils/helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Dependabot
module Docker
module Utils
HELM_REGEXP = /values[\-a-zA-Z_0-9]*\.ya?ml$/i

def self.likely_helm_chart?(file)
file.name.match?(HELM_REGEXP)
end
end
end
end