logstash-plugins / logstash-codec-avro

A logstash codec plugin for decoding and encoding Avro records
Apache License 2.0
15 stars 63 forks source link

Investigate why PR #45 fails #46

Closed andsel closed 3 months ago

andsel commented 5 months ago

Running the #45 locally with

export ELASTIC_STACK_VERSION=7.x
.ci/docker-setup.sh

it goes in troubles resolving dependencies:

#15 7.390     logstash-devutils java was resolved to 2.6.2, which depends on
#15 7.390       rspec (~> 3.0) java was resolved to 3.13.0, which depends on
#15 7.390         rspec-core (~> 3.13.0) java was resolved to 3.13.0, which depends on
#15 7.390           ruby (>= 1.8.7) java
#15 ERROR: process "/bin/sh -c bundle install --with test ci" did not complete successfully: exit code: 6
------
 > [logstash 11/13] RUN bundle install --with test ci:
7.390         ruby (>= 2.0) java
7.390
7.390     logstash-core java was resolved to 7.17.22, which depends on
7.390       puma (~> 5, >= 5.6.8) java was resolved to 5.6.8, which depends on
7.390         ruby (>= 2.2) java
7.390
7.390     logstash-devutils java was resolved to 2.6.2, which depends on
7.390       rspec (~> 3.0) java was resolved to 3.13.0, which depends on
7.390         rspec-core (~> 3.13.0) java was resolved to 3.13.0, which depends on
7.390           ruby (>= 1.8.7) java
------

Same happens also on CI https://app.travis-ci.com/github/logstash-plugins/logstash-codec-avro/jobs/622355109#L502

If the gemspec dependency

s.add_runtime_dependency "avro", "~> 1.11.3"

is moved back to

s.add_runtime_dependency "avro", "~> 1.10.2"

despite the transitive dependency, as showed by rubygems, is the same: multi_json 1.15.0 -> rspec 3.13.0 -> rspec-core 3.13.0

jsvd commented 5 months ago

This is likely due to jruby 9.2 being ruby 2.5 compatible, and avro gem 0.11.0 adding a dependency on ruby >= 2.6:

/tmp/logstash-7.17.21
❯ ./vendor/jruby/bin/jruby -v
jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 OpenJDK 64-Bit Server VM 21.0.2+13-LTS on 21.0.2+13-LTS +jit [darwin-aarch64]

~/elastic/logstash-plugins/logstash-codec-avro main* 10s
❯ bundle update
Your RubyGems version (3.1.6) has a bug that prevents `required_ruby_version` from working for Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drops support for your Ruby version. Please upgrade RubyGems to avoid future breakage and silence this warning by running `gem update --system 3.2.3`
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies....
Bundler found conflicting requirements for the Ruby version:
  In Gemfile:
    logstash-codec-avro was resolved to 3.4.1, which depends on
      avro (~> 1.11.3) was resolved to 1.11.3, which depends on
        Ruby (>= 2.6)

  Current Ruby version:
    Ruby (= 2.5.8)
andsel commented 5 months ago

https://github.com/apache/avro/blob/release-1.11.3/lang/ruby/avro.gemspec#L28

and also with https://github.com/apache/avro/pull/1367 they switched from Gemfile to .gemspec and added the dependency to Ruby .2.6

andsel commented 3 months ago

To sumarize: Ruby's Avro 1.11+ is not compatible with Logstash 7.17 because requires Ruby 2.6+ while the one provided by Logstash is 2.5