-
Notifications
You must be signed in to change notification settings - Fork 139
Pin dependency versions for Ruby <2.7 #347
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
base: master
Are you sure you want to change the base?
Conversation
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
Maybe we should fix the gemspec of aws-sigv4 first, it seems to be the root cause.
|
I'm not sure I follow - AWS were pretty explicit in dropping support for versions earlier than 2.7. Even if we were to fix the version restrictions for |
72cfffa
to
f6c4091
Compare
@khiav223577 Note that this was similar to what was done in #314. This change ensures Ruby 2.5 and 2.6 will continue to function with this gem. It seems older versions of |
I’m doubtful that adding an if-condition in vault.gemspec would work as expected. When the gem is built, the .gemspec file is evaluated only once, and the resulting specification is based on the environment of the machine performing the build. The final gemspec uploaded to RubyGems appears to include only the resolved dependencies from the build-time environment. We can see the vault gem lists only a single runtime dependency: |
I thought that too, but it turns out the conditionals are evaluated in RubyGems only shows one version, but that's probably because it's simpler just to show that. However, when We have confirmed that this change does do the right thing for Ruby 2.5 and 2.6. |
The author of PR #314 left a comment here, mentioning that he's still unable to install the gem on Ruby 2.3. If the conditional logic in the gemspec is evaluated at install time, can we confirm whether this issue has been resolved in version 0.18.2? |
Ah, indeed, this conditional doesn't work after all. I did some testing and found that with a forked gem that has these conditionals (https://rubygems.org/gems/gl-vault), the versions dependencies generated in the resulting With
Using this script, we can decode the dependencies: require 'net/http'
require 'zlib'
uri = URI('https://rubygems.org/quick/Marshal.4.8/gl-vault-0.19.0.gemspec.rz')
compressed_data = Net::HTTP.get(uri)
decompressed_data = Zlib::Inflate.inflate(compressed_data)
gemspec = Marshal.load(decompressed_data)
puts gemspec.dependencies.map(&:inspect) The result:
|
I looked deeper into the RubyGems source code to understand what happens when running It turns out that dependency resolution is handled via the URL: https://index.rubygems.org/info/vault (source code). From what I can see, any conditional logic in the gemspec doesn’t appear to be reflected in the dependency data returned from that endpoint. |
I think this approach could help resolve the dependency issues across different Ruby versions: Release v0.18.2.1 when .gemspec:
Release v0.18.2.2 when .gemspec:
Release v0.18.3 when .gemspec:
In the future, we might consider dropping support for Ruby versions older than 2.7 to reduce maintenance overhead, since maintaining three parallel releases can become burdensome. What do you think? |
Right, that's what I was saying in #347 (comment).
Sounds like a good plan to me. |
This change pins the versions of
aws-sigv4
andaws-eventstream
used with Ruby <2.7. AWS recently dropped support for Ruby 2.5/2.6 and because there is no version pinning foraws-sigv4
in the gemspec otherwise, it tries to download the latest version which is incompatible with these older versions of Ruby.Without this change, installations fail with something similar to the following: