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

Running bundle check causes the lockfile to change to a platform specific version of google-protobuf #5325

Closed
daemonsy opened this issue Jan 31, 2022 · 4 comments

Comments

@daemonsy
Copy link

daemonsy commented Jan 31, 2022

Describe the problem as clearly as you can

On a gem I'm helping to maintain, we have google-protobuf as a dependency. Our bundler platform is set to ruby.

The Gemfile.lock has this entry.

    google-protobuf (3.19.3)

But when our semantic-bot releases a new version, it gets changed to

    google-protobuf (3.19.3-x86_64-linux)

After some investigation, it seems that bundle check is the one changing the Gemfile.lock to the platform specific version and bundle changes it back to a non platform specific version.

More context: Bundle check is run by the appraisals gem and running bundle exec appraisal install generates statements like this:

bundle check --gemfile="$(pwd)/gemfiles/graphql_1.10.gemfile" || bundle install --gemfile="$(pwd)/gemfiles/graphql_1.10.gemfile" --retry 1

Did you try upgrading rubygems & bundler?

  • rubygems 3.3.6
  • bundler 2.3.6
  • Ruby 2.6.9 on a Mac
  • cimg/ruby-2.7.5-node on Docker

Post steps to reproduce the problem

Using this branch as the base (small Dockerfile included):

  1. In the repository root folder, run bundle install
  2. Run bundle check --gemfile="$(pwd)/gemfiles/graphql_1.10.gemfile"
  3. The file gemfiles/graphql_1.10.gemfile.lock changes to a platform specific version
  4. If we ran bundle install --gemfile="$(pwd)/gemfiles/graphql_1.10.gemfile" instead, gemfiles/graphql_1.10.gemfile.lock does not change to a platform specific version.

Which command did you run?

bundle check

What were you expecting to happen?

bundle check should have the same effect as bundle install to any Gemfile or Gemfile.lock that is touched by bundler.

What actually happened?

The bundle check command causes platform specific changes to the lockfiles.

If not included with the output of your command, run bundle env and paste the output below

Environment

Bundler       2.3.6
  Platforms   ruby, x86_64-darwin-21
Ruby          2.6.9p207 (2021-11-24 revision 67954) [x86_64-darwin-21]
  Full Path   /Users/me/.rubies/ruby-2.6.9/bin/ruby
  Config Dir  /Users/me/.rubies/ruby-2.6.9/etc
RubyGems      3.3.6
  Gem Home    /Users/me/.gem/ruby/2.6.9
  Gem Path    /Users/me/.gem/ruby/2.6.9:/Users/me/.rubies/ruby-2.6.9/lib/ruby/gems/2.6.0
  User Home   /Users/me
  User Path   /Users/me/.gem/ruby/2.6.0
  Bin Dir     /Users/me/.gem/ruby/2.6.9/bin
Tools         
  Git         2.33.1
  RVM         not installed
  rbenv       not installed
  chruby      0.3.9

Bundler Build Metadata

Built At          2022-01-26
Git SHA           056f64c33a
Released Version  true

Gemfile

Gemfile

# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

gem 'graphql', '1.10.14'

Gemfile.lock

PATH
  remote: .
  specs:
    apollo-federation (2.0.1)
      google-protobuf (~> 3.19)
      graphql (>= 1.10.14)

GEM
  remote: https://rubygems.org/
  specs:
    actionpack (6.0.3.3)
      actionview (= 6.0.3.3)
      activesupport (= 6.0.3.3)
      rack (~> 2.0, >= 2.0.8)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actionview (6.0.3.3)
      activesupport (= 6.0.3.3)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activesupport (6.0.3.3)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
      zeitwerk (~> 2.2, >= 2.2.2)
    appraisal (2.3.0)
      bundler
      rake
      thor (>= 0.14.0)
    ast (2.4.0)
    builder (3.2.4)
    byebug (11.0.1)
    coderay (1.1.2)
    concurrent-ruby (1.1.7)
    crass (1.0.6)
    debase (0.2.4.1)
      debase-ruby_core_source (>= 0.10.2)
    debase-ruby_core_source (0.10.9)
    diff-lcs (1.3)
    erubi (1.9.0)
    google-protobuf (3.19.3)
    graphql (1.10.14)
    i18n (1.8.5)
      concurrent-ruby (~> 1.0)
    jaro_winkler (1.5.3)
    loofah (2.7.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    method_source (0.9.2)
    mini_portile2 (2.4.0)
    minitest (5.14.2)
    nokogiri (1.10.10)
      mini_portile2 (~> 2.4.0)
    parallel (1.17.0)
    parser (2.6.3.0)
      ast (~> 2.4.0)
    pry (0.12.2)
      coderay (~> 1.1.0)
      method_source (~> 0.9.0)
    pry-byebug (3.7.0)
      byebug (~> 11.0)
      pry (~> 0.10)
    rack (2.2.3)
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    rainbow (3.0.0)
    rake (13.0.1)
    rspec (3.8.0)
      rspec-core (~> 3.8.0)
      rspec-expectations (~> 3.8.0)
      rspec-mocks (~> 3.8.0)
    rspec-core (3.8.0)
      rspec-support (~> 3.8.0)
    rspec-expectations (3.8.3)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.8.0)
    rspec-mocks (3.8.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.8.0)
    rspec-support (3.8.0)
    rubocop (0.72.0)
      jaro_winkler (~> 1.5.1)
      parallel (~> 1.10)
      parser (>= 2.6)
      rainbow (>= 2.2.2, < 4.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 1.4.0, < 1.7)
    rubocop-rspec (1.33.0)
      rubocop (>= 0.60.0)
    ruby-debug-ide (0.7.2)
      rake (>= 0.8.1)
    ruby-progressbar (1.10.1)
    thor (1.0.1)
    thread_safe (0.3.6)
    tzinfo (1.2.7)
      thread_safe (~> 0.1)
    unicode-display_width (1.6.0)
    zeitwerk (2.4.0)

PLATFORMS
  ruby

DEPENDENCIES
  actionpack
  apollo-federation!
  appraisal
  debase
  graphql (= 1.10.14)
  pry-byebug
  rack
  rake
  rspec
  rubocop (~> 0.72.0)
  rubocop-rspec
  ruby-debug-ide

BUNDLED WITH
   2.3.6

Gemspecs

apollo-federation.gemspec

# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'apollo-federation/version'

Gem::Specification.new do |spec|
  spec.name          = 'apollo-federation'
  spec.version       = ApolloFederation::VERSION
  spec.authors       = []
  spec.email         = []

  spec.summary       = 'A Ruby implementation of Apollo Federation'
  spec.description   = spec.summary
  spec.homepage      = 'https://github.com/Gusto/apollo-federation-ruby'
  spec.license       = 'MIT'
  spec.required_ruby_version = '>= 2.2.0' # bc of `.to_sym`

  spec.metadata    = {
    'homepage_uri' => 'https://github.com/Gusto/apollo-federation-ruby',
    'changelog_uri' => 'https://github.com/Gusto/apollo-federation-ruby/releases',
    'source_code_uri' => 'https://github.com/Gusto/apollo-federation-ruby',
    'bug_tracker_uri' => 'https://github.com/Gusto/apollo-federation-ruby/issues',
  }

  spec.files = `git ls-files bin lib *.md LICENSE`.split("\n")

  spec.add_dependency 'graphql', '>= 1.10.14'

  spec.add_runtime_dependency 'google-protobuf', '~> 3.19'

  spec.add_development_dependency 'actionpack'
  spec.add_development_dependency 'appraisal'
  spec.add_development_dependency 'debase'
  spec.add_development_dependency 'pry-byebug'
  spec.add_development_dependency 'rack'
  spec.add_development_dependency 'rake'
  spec.add_development_dependency 'rspec'
  spec.add_development_dependency 'rubocop', '~> 0.72.0'
  spec.add_development_dependency 'rubocop-rspec'
  spec.add_development_dependency 'ruby-debug-ide'
end
@deivid-rodriguez
Copy link
Member

Thanks for the very helpful report, it does seem like a bug.

@deivid-rodriguez
Copy link
Member

I will have a look.

@deivid-rodriguez
Copy link
Member

Hei @daemonsy, I tried to reproduce this but I couldn't.

I used the provided Dockerfile except that I mounted the CWD manually though docker --mount option, instead of manually copying inside the Dockerfile, because in the latter case files would get inadequate permissions and I would get errors when trying to write a lockfile. Anyways, running the mentioned commands did not generate any unexpected lockfile changes.

Can you share exact docker commands to reproduce the error?

@carlwiedemann
Copy link

I believe this problem could still be happening. It appears to happen if the lockfile is out-of-date with the Gemfile. For example, if a gem has been removed in the Gemfile, then when the lockfile is regenerated, the platforms will revert.

It can be fixed by effectively running bundle lock --add-platform ruby, then removing the platform-specific lines manually.

I will attempt to reproduce with a Dockerfile to demonstrate the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants