-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix updating GitHub Actions & Dockerfiles with mixed versions #6082
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -301,7 +301,7 @@ | |
expect(dependency_set.dependency_for_name("foo")).to eq( | ||
Dependabot::Dependency.new( | ||
name: "foo", | ||
version: "1.0", | ||
version: "1.1", | ||
requirements: ( | ||
foo_v1.requirements + | ||
foo_sha.requirements + | ||
|
@@ -325,7 +325,7 @@ | |
expect(combined_set.dependency_for_name("foo")).to eq( | ||
Dependabot::Dependency.new( | ||
name: "foo", | ||
version: "1.0", | ||
version: "1.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same explanation as in common/spec/dependabot/file_parsers/base/dependency_set_spec.rb (version of top-level dependency wins). |
||
requirements: ( | ||
foo_v1.requirements + | ||
foo_sha.requirements + | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -628,7 +628,7 @@ | |
expect(dependency).to be_a(Dependabot::Dependency) | ||
expect(dependency.name). | ||
to eq("org.apache.maven.plugins:maven-javadoc-plugin") | ||
expect(dependency.version).to eq("3.0.0-M1") | ||
expect(dependency.version).to eq("2.10.4") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new logic prefers lower versions if the dependencies are of the same type. This makes sense because it prevents misdirecting things as out of date, and was already the "spirit" of the code. But, due to this bug, sometimes the higher version would win depending on parsing order. |
||
expect(dependency.requirements).to eq( | ||
[{ | ||
requirement: "3.0.0-M1", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,7 @@ | |
), | ||
Dependabot::Dependency.new( | ||
name: "bar", | ||
version: "0.2.3", | ||
version: "0.2.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same explanation as in maven/spec/dependabot/maven/file_parser_spec.rb (lowest version wins). |
||
requirements: (bar_c.requirements + bar_b.requirements + bar_a.requirements).uniq, | ||
package_manager: "npm_and_yarn", | ||
metadata: { all_versions: [bar_c, bar_b, bar_a] } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,7 @@ | |
it "has the right details" do | ||
expect(dependency).to be_a(Dependabot::Dependency) | ||
expect(dependency.name).to eq("Microsoft.Extensions.DependencyModel") | ||
expect(dependency.version).to eq("1.1.1") | ||
expect(dependency.version).to eq("1.0.1") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same explanation as in the maven/spec/dependabot/maven/file_parser_spec.rb (lowest version wins). |
||
expect(dependency.requirements).to eq( | ||
[{ | ||
requirement: "1.1.1", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If one dependency in the set is a top level dependency (the one at 1.1 in this case), and another one is not (the one at 1.0), then the version of the top level dependency is chosen.
The previous logic would only do this sometimes, in a way that was dependent on the order dependencies are parsed. If a top level dependency would be parsed first, and then an indirect dependency merged into the Dependency Set, then the version of the top level dependency would be respected. But the version of the indirect dependency would win if lower and if the indirect dependency parsed first.
The new logic has the same spirit but it's order independent.