Skip to content
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

Move to Faraday 2.x, which requires Ruby 2.6+ #99

Merged
merged 3 commits into from
Nov 30, 2022

Conversation

ekohl
Copy link
Contributor

@ekohl ekohl commented Jun 9, 2022

It does not attempt to support Faraday 1.x as well because dependency wise it would be impossible to pull in the correct middleware. That is why a hard switch was made.

See individual commits for details.

Replaces #98, #97 & #96.

This would be a major version bump.

ekohl added 3 commits June 9, 2022 15:02
This avoids the need to install bundler and adds caching between runs.
The minimum version was declared as Ruby 2.4 so these conditionals do
not make sense.

Fixes: 05a4e77
It does not attempt to support Faraday 1.x as well because dependency
wise it would be impossible to pull in the correct middleware. That is
why a hard switch was made.

This moves the minimum Ruby version to 2.6 since that's what Faraday 2
has as the minimum version.

It also pulls in faraday-follow_redirects, which was previously part of
Faraday itself.

The registration is now done without a lamba since it's allowed to pass
in a constant.

CI is also modified to test on all actual Ruby version that currently
match the required_ruby_version in the gemspec. That is, 2.6 - 3.1.
@ekohl ekohl requested a review from a team as a code owner June 9, 2022 13:11
Copy link
Collaborator

@bastelfreak bastelfreak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. I suggest to update the PR title so it mentions Ruby 2.5 removal as well.

@ekohl ekohl changed the title Move to Faraday 2.x Move to Faraday 2.x, which requires Ruby 2.6+ Jun 9, 2022
@binford2k
Copy link
Contributor

What are the advantages of moving to Faraday 2.x? It's only been released for a few months. The latest 1.x release is also just a few months old.

Ruby 2.5 reached end of life more than a year ago though. https://endoflife.date/ruby

@beechtom
Copy link

beechtom commented Jun 9, 2022

@binford2k Fewer runtime dependencies than the 1.x series and (presumably) active development will continue only on the 2.x series at some point.

Skeletor is working on getting faraday updated in orchestrator_client and bolt, and the 1.x series has 11 runtime dependencies we'd need to pull in and ship. The 2.x series works with minimal changes and has a single runtime dependency, which is appealing since there are far fewer gem components to track and maintain.

@ekohl
Copy link
Contributor Author

ekohl commented Jun 9, 2022

@binford2k on newer Rubies you get deprecation warnings. It was reported in voxpupuli/librarian-puppet#91 and voxpupuli/modulesync_config#784, pointing to faraday-multipart. However, I now see that lostisland/faraday-multipart@2127a0c was released in https://github.com/lostisland/faraday-multipart/releases/tag/v1.0.4 so perhaps it's less urgent now.

That said, being compatible with the latest version is probably a good thing. Having at least something that works is a good start to investigate possible collisions. For example, https://github.com/github-changelog-generator/github-changelog-generator is also a commonly used tool in modules and also pulls in Faraday. That doesn't pin the version so it can create conflicts.

I'll submit the unrelated commits in separate PRs because they can get merged and reduce the size of this PR.

@bastelfreak
Copy link
Collaborator

@binford2k I'm packaging Ruby packages for Linux distributions. Many tools already allow faraday (some might have already dropped support for faraday 1). Using faraday 2 in forge-ruby would allow me to update the package on Arch Linux. Besides that I agree with the statements from @ekohl and @beechtom .

@crazymind1337
Copy link

crazymind1337 commented Nov 16, 2022

@binford2k Can we please have a new release with this soon. Those warning message are annoying me every time I run my rspec tests.

@crazymind1337
Copy link

Would be really nice if we could make this PR possible soon, I getting more and more frustrated because of this issue and dependency issues like:

Bundler could not find compatible versions for gem "faraday_middleware":
  In Gemfile:
    inspec (= 5.18.14) was resolved to 5.18.14, which depends on
      inspec-core (= 5.18.14) was resolved to 5.18.14, which depends on
        faraday_middleware (~> 1.0)

    kitchen-puppet (= 3.6.0) was resolved to 3.6.0, which depends on
      librarian-puppet (>= 3.0) was resolved to 3.0.1, which depends on
        puppet_forge (~> 2.1) was resolved to 2.1.1, which depends on
          faraday_middleware (~> 0.9.0)

I would like to update kitchen-puppet in our CI - but I am not able because of this issue.

@barriserloth barriserloth merged commit 614ad2c into puppetlabs:main Nov 30, 2022
@crazymind1337
Copy link

Thanks!

@johnwarburton
Copy link

This breaks puppet-agent 6.X (EOL July 2023) as it ships with ruby 2.5.x (https://puppet.com/docs/puppet/6/platform_lifecycle.html#puppet-agent-components)

We now have to pin puppet_forge version to 3.2.0 on standalone puppet-agent 6.x for r10k to work

@bastelfreak
Copy link
Collaborator

@johnwarburton can you explain how you trigger the error / how we can repeoduce it?

@ekohl ekohl deleted the faraday-2 branch December 9, 2022 16:37
@ekohl
Copy link
Contributor Author

ekohl commented Dec 9, 2022

@bastelfreak IIRC the rubygems version in Ruby 2.5 doesn't work well with the minimum ruby version that's declared. Perhaps it's ignoring it and causing problems.

@johnwarburton
Copy link

Hi @bastelfreak - no problem:

start with a clean machine - EL7 - with no puppet installed

# yum -y install  https://yum.puppet.com/puppet6-release-el-7.noarch.rpm
# yum -y install puppet-agent
# /opt/puppetlabs/puppet/bin/ruby --version
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
# /opt/puppetlabs/puppet/bin/gem install r10k
Fetching: colored2-3.1.2.gem (100%)
Successfully installed colored2-3.1.2
Fetching: cri-2.15.11.gem (100%)
Successfully installed cri-2.15.11
Fetching: log4r-1.1.10.gem (100%)
Successfully installed log4r-1.1.10
Fetching: faraday-net_http-3.0.2.gem (100%)
ERROR:  Error installing r10k:
        The last version of faraday-net_http (< 3.1, >= 2.0) to support your Ruby & RubyGems was 2.1.0. Try installing it with `gem install faraday-net_http -v 2.1.0` and then running the current command again
        faraday-net_http requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

# /opt/puppetlabs/puppet/bin/gem install puppet_forge --version 3.2.0                                                                                                                                  [36/530]
Fetching: minitar-0.9.gem (100%)
The `minitar` executable is no longer bundled with `minitar`. If you are
expecting this executable, make sure you also install `minitar-cli`.
Successfully installed minitar-0.9
Fetching: faraday-em_http-1.0.0.gem (100%)
Successfully installed faraday-em_http-1.0.0
Fetching: faraday-em_synchrony-1.0.0.gem (100%)
Successfully installed faraday-em_synchrony-1.0.0
Fetching: faraday-excon-1.1.0.gem (100%)
Successfully installed faraday-excon-1.1.0
Fetching: faraday-httpclient-1.0.1.gem (100%)
Successfully installed faraday-httpclient-1.0.1
Fetching: multipart-post-2.2.3.gem (100%)
Successfully installed multipart-post-2.2.3
Fetching: faraday-multipart-1.0.4.gem (100%)
Successfully installed faraday-multipart-1.0.4
Fetching: faraday-net_http-1.0.1.gem (100%)
Successfully installed faraday-net_http-1.0.1
Fetching: faraday-net_http_persistent-1.2.0.gem (100%)
Successfully installed faraday-net_http_persistent-1.2.0
Fetching: faraday-patron-1.0.0.gem (100%)
Successfully installed faraday-patron-1.0.0
Fetching: faraday-rack-1.0.0.gem (100%)
Successfully installed faraday-rack-1.0.0
Fetching: faraday-retry-1.0.3.gem (100%)
Successfully installed faraday-retry-1.0.3
Fetching: ruby2_keywords-0.0.5.gem (100%)
Successfully installed ruby2_keywords-0.0.5
Fetching: faraday-1.10.2.gem (100%)
Successfully installed faraday-1.10.2
Fetching: faraday_middleware-1.2.0.gem (100%)
Successfully installed faraday_middleware-1.2.0
Fetching: puppet_forge-3.2.0.gem (100%)
Successfully installed puppet_forge-3.2.0
Parsing documentation for minitar-0.9
Installing ri documentation for minitar-0.9
Parsing documentation for faraday-em_http-1.0.0
Installing ri documentation for faraday-em_http-1.0.0
Parsing documentation for faraday-em_synchrony-1.0.0
Installing ri documentation for faraday-em_synchrony-1.0.0
Parsing documentation for faraday-excon-1.1.0
Installing ri documentation for faraday-excon-1.1.0
Parsing documentation for faraday-httpclient-1.0.1
Installing ri documentation for faraday-httpclient-1.0.1
Parsing documentation for multipart-post-2.2.3
Installing ri documentation for multipart-post-2.2.3
Parsing documentation for faraday-multipart-1.0.4
Installing ri documentation for faraday-multipart-1.0.4
Parsing documentation for faraday-net_http-1.0.1
Installing ri documentation for faraday-net_http-1.0.1
Parsing documentation for faraday-net_http_persistent-1.2.0
Installing ri documentation for faraday-net_http_persistent-1.2.0
Parsing documentation for faraday-patron-1.0.0
Installing ri documentation for faraday-patron-1.0.0
Parsing documentation for faraday-rack-1.0.0
Installing ri documentation for faraday-rack-1.0.0
Parsing documentation for faraday-retry-1.0.3
Installing ri documentation for faraday-retry-1.0.3
Parsing documentation for ruby2_keywords-0.0.5
Installing ri documentation for ruby2_keywords-0.0.5
Parsing documentation for faraday-1.10.2
Installing ri documentation for faraday-1.10.2
Parsing documentation for faraday_middleware-1.2.0
Installing ri documentation for faraday_middleware-1.2.0
Parsing documentation for puppet_forge-3.2.0
Installing ri documentation for puppet_forge-3.2.0
Done installing documentation for minitar, faraday-em_http, faraday-em_synchrony, faraday-excon, faraday-httpclient, multipart-post, faraday-multipart, faraday-net_http, faraday-net_http_persistent, faraday-patron, faraday-r
ack, faraday-retry, ruby2_keywords, faraday, faraday_middleware, puppet_forge after 1 seconds
16 gems installed

# /opt/puppetlabs/puppet/bin/gem install r10k
Fetching: gettext-setup-0.34.gem (100%)
Successfully installed gettext-setup-0.34
Fetching: jwt-2.2.3.gem (100%)
Successfully installed jwt-2.2.3
Fetching: r10k-3.15.2.gem (100%)
Successfully installed r10k-3.15.2
Parsing documentation for gettext-setup-0.34
Installing ri documentation for gettext-setup-0.34
Parsing documentation for jwt-2.2.3
Installing ri documentation for jwt-2.2.3
Parsing documentation for r10k-3.15.2
Installing ri documentation for r10k-3.15.2
Done installing documentation for gettext-setup, jwt, r10k after 1 seconds
3 gems installed

@bastelfreak
Copy link
Collaborator

Ah yes. IMO this is expected and you need to pin to older versions (or don't use an EoL Ruby Version or install r10k in a different way).

@johnwarburton
Copy link

Yes, we've come to that conclusion already

Its more of an FYI that this is happening with an official currently supported release of puppet which is EOL July 2023 and it ships with "EoL" ruby 2.5.x (https://puppet.com/docs/puppet/6/platform_lifecycle.html#puppet-agent-components) so there is no choice apart from moving to puppet 7 - which is in progress

This is the officially documented way to install r10k

binford2k added a commit to binford2k/dropsonde that referenced this pull request Jan 16, 2023
[This pull request](puppetlabs/forge-ruby#99)
dropped support for Ruby 2.5, which still ships with some Puppet
versions. Let's pin to the previous version so that Dropsonde still
operates on older Puppet versions for now. We'll update this once
community adoption of Puppet 7+ catches up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants