Add support for versions using git revision suffixes for Maven and Gradle#13998
Conversation
e36d11b to
4433784
Compare
00bb36a to
5107728
Compare
| let(:dependency_version) { "5933.vcf06f7b_5d1a_2" } | ||
| let(:comparison_version) { "5857.vb_f3dd0731f44" } |
There was a problem hiding this comment.
Would suggest a test checking explicitly the case most recently observed to fail, that https://github.com/jenkinsci/plugin-pom/releases/tag/6.2108.v08c2b_01b_cf4d is not considered superseded by https://github.com/jenkinsci/plugin-pom/releases/tag/6.2122.v70b_7b_f659d72 which I suppose was a regression from #13818. None of the examples here seem to include a prefix prior to the revision count, as used for example in https://github.com/jenkinsci/plugin-pom/blob/623345749f5978fee57ab0e670f1f980dd5b05cd/pom.xml#L57 or even https://github.com/jenkinsci/jjwt-api-plugin/blob/b2c204d6cd36e8597dddade93d7cc95f12074943/pom.xml#L16
There was a problem hiding this comment.
Thank you for the feedback @jglick. I updated the tests cases to consider that format as well as others I could find. Could you please review and let me know if I am missing any scenario?
Thanks in advance for your time and understanding
410ea63 to
cab9a6a
Compare
Thanks @yeikel . I will check it hopefully today otherwise next week after Tuesday. |
10424f4 to
f4d7925
Compare
Hey @kbukum1 just pinging to see if you got a chance to review this? Thanks |
Hi @yeikel , sorry I have some workload and I really couldn't review that. I am hoping by mid of next week I will do review. |
f4d7925 to
d76c8b5
Compare
af4a89e to
7f1e06a
Compare
|
@kbukum1 any chance you can get to it this week? |
93b6ba5 to
31e37f2
Compare
31e37f2 to
a7d0fdc
Compare
a7d0fdc to
5ac635f
Compare
|
Nice work! Can you evaluate the following additional specs and if it is valid, it will be great if we can cover them. Other than this it looks good to me. 1. Valid length but invalid hex characters: context "when suffix has valid length but invalid hex characters" do
let(:dependency_version) { "100-vghijklm" }
let(:comparison_version) { "200-vhijklmn" }
it { is_expected.to be false }
end2. All-numeric string (no a-f letters): context "when suffix is all-numeric and could be confused for a SHA" do
let(:dependency_version) { "100.v1234567" }
let(:comparison_version) { "200.v7654321" }
it { is_expected.to be false }
end3. SHA exceeds max length (41+ chars): context "when git SHA exceeds maximum length (41+ chars)" do
let(:dependency_version) { "100.va1b2c3d4e5f6789012345678901234567890ab" }
let(:comparison_version) { "200.vb2c3d4e5f6789012345678901234567890abc" }
it { is_expected.to be false }
end4. Reverse direction — current has SHA, candidate is plain semver: context "when current has git SHA and candidate is standard semver" do
let(:dependency_version) { "1.2.3.va1b2c3d" }
let(:comparison_version) { "1.2.4" }
it { is_expected.to be true }
end |
fb1ba86 to
d11b4a3
Compare
Thank you for the feedback @kbukum1. I applied it in the latest revision: https://github.com/yeikel/dependabot-core/blob/d11b4a3ad3ed9f9ac0bad8e382521781eb465aa8/maven/spec/dependabot/maven/shared/shared_version_finder_spec.rb#L641-L667 |
|
@yeikel, I checked with copilot and seems like the cause is Analyse: The When
The fix should ensure that unrecognized/non-standard version formats don't block upgrades. A couple of options:
One more thing on test coverage: Consider adding a test for a suffix with valid SHA length but invalid hex characters (e.g., |
d11b4a3 to
2771db5
Compare
2771db5 to
3fa382d
Compare
Thank you @kbukum1. I updated it based on your feedback and added these additional tests cases to the test suite to protect ourselves from regressions as you suggested |
What are you trying to accomplish?
Adds support for detecting versions that include embedded Git commits in both short and long format.
The updated logic correctly parses version strings with Git revision suffixes, as used by some Maven projects (e.g., the Jenkins plugins organization). Examples:
2.9.2-29.v717aac953ff3,2.9.3-29.v717aac953ff3This is a follow-up for #13818 #13999
Fixes #14102
How will you know you've accomplished your goal?
Both the existing and new specs pass. I was able to reproduce the issue with the tests, and the new code resolves it
Note to reviewers
Checklist