Skip to content

Commit

Permalink
Revert "Docker: Ignore ARGs without default values"
Browse files Browse the repository at this point in the history
This reverts commit 27811af.
  • Loading branch information
mctofu committed Feb 22, 2022
1 parent 93507b8 commit 456cbfc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 0 additions & 2 deletions docker/lib/dependabot/docker/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def parse
dockerfile.content.each_line do |line|
if ARG.match(line)
key_value = line.delete_prefix("ARG ").split("=")
next if key_value.count != 2 # The ARG has no default value that we can set

args[key_value[0]] = key_value[1].delete_suffix("\n")
next
end
Expand Down
14 changes: 4 additions & 10 deletions docker/spec/dependabot/docker/file_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,19 @@
expect(dependency.name).to eq("docker")
end
end
end

describe "with curls" do
let(:dockerfile_fixture_name) { "arg_from_curls" }
context "arg from" do
let(:dockerfile_fixture_name) { "arg_from_curls" }

describe "with curls" do
subject(:dependency) { dependencies.first }

it "can solve the dependency" do
expect(dependency).to be_a(Dependabot::Dependency)
expect(dependency.name).to eq("docker")
end
end

describe "without a default value" do
let(:dockerfile_fixture_name) { "arg_from_no_default" }

it "can't solve the dependency" do
expect(dependencies).to be_empty
end
end
end

context "with a non-numeric version" do
Expand Down
2 changes: 0 additions & 2 deletions docker/spec/fixtures/docker/dockerfiles/arg_from_no_default

This file was deleted.

0 comments on commit 456cbfc

Please sign in to comment.