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

Updates from rspec-dev (2019-01-03) #2061

Merged
merged 3 commits into from
Jan 9, 2019

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Jan 3, 2019

These are some updates, generated from rspec-dev's rake tasks.

benoittgt
benoittgt previously approved these changes Jan 4, 2019
Copy link
Member

@benoittgt benoittgt left a comment

Choose a reason for hiding this comment

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

LGTM

@benoittgt benoittgt dismissed their stale review January 4, 2019 09:02

We miss link to travis script

@benoittgt
Copy link
Member

ERROR: Could not find a valid gem '1.17.3' (>= 0) in any repository

But https://rubygems.org/gems/bundler/versions/1.17.3

@JonRowe
Copy link
Member Author

JonRowe commented Jan 4, 2019

Yes, again, this wasn't the WIP repo, so it got updated last.

@JonRowe
Copy link
Member Author

JonRowe commented Jan 4, 2019

Once I had rspec/rspec-support#362 working the changes got backported

@JonRowe JonRowe force-pushed the update-travis-build-scripts-2019-01-03-for-master branch 2 times, most recently from 8830e4a to 6d370ad Compare January 4, 2019 19:06
@benoittgt
Copy link
Member

It seems the CI install multiple version of Bundler. I saw that your task install bundler then try to uninstall bundler if Rails version is under 5 then install bundler 1.17.3.

Reading : https://travis-ci.org/rspec/rspec-rails/jobs/475443754

  • $ export RAILS_VERSION='~> 4.2.0'
  • rvm use 2.4.4 --install --binary --fuzzy so we should use bundler 1.17.3
  • From the cache
    • $ bundle --version
      • Bundler version 1.16.2 1️⃣
    • $ gem --version
      • 2.7.7
  • script/update_rubygems_and_install_bundler
    • Successfully installed rubygems-update-3.0.2
    • Bundler 1.17.3 installed 2️⃣
    • RubyGems system software updated
    • Fetching bundler-2.0.1.gem
    • Successfully installed bundler-2.0.1 3️⃣
  • script/downgrade_bundler_on_old_rails output nothing 🤔

I count 3 versions before running RSpec test suite.

Why did you prefer to add a specific uninstall script rather than installing bundler at the right version first in update_rubygems_and_install_bundler script? Do you want to stay as sync as possible from rspec-dev?

source script/functions.sh

if is_ruby_23_plus; then
if ruby -e "exit(!(ENV['RAILS_VERSION'].to_f < 5))"; then
Copy link
Member

Choose a reason for hiding this comment

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

I think there is a mistake. We don't need the bang.

With:

set -e

ruby -v
echo $RAILS_VERSION

function is_ruby_23_plus {
  if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
    return 0
  else
    return 1
  fi
}

if is_ruby_23_plus; then
  if ruby -e "exit(ENV['RAILS_VERSION'].to_f < 5)"; then
    # On Rails versions less than 5, Bundler 2.0 is not supported
    echo "Warning dowgrading to older version of Bundler"
    gem uninstall bundler
    gem install bundler -v '1.17.3'
  else
    echo "Rails >= 5"
  fi
fi

output

ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
~> 4.2.0
Warning dowgrading to older version of Bundler

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes a typo from a half way though

if is_ruby_23_plus; then
if ruby -e "exit(!(ENV['RAILS_VERSION'].to_f < 5))"; then
# On Rails versions less than 5, Bundler 2.0 is not supported
echo "Warning dowgrading to older version of Bundler"
Copy link
Member

Choose a reason for hiding this comment

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

Oups "downgrading" 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@JonRowe JonRowe force-pushed the update-travis-build-scripts-2019-01-03-for-master branch from 6d370ad to 9462508 Compare January 7, 2019 18:37
@JonRowe
Copy link
Member Author

JonRowe commented Jan 7, 2019

@benoittgt I want to leave the current rspec-dev as is given rspec-rails is different, this is the easiest fix for older Rails, when rspec-rails 4 is release I expect this will go away quite quickly, as it drops older Rails in line with Rails

@benoittgt
Copy link
Member

The CI is failing on few versions. It seems we are getting bundler from the image/cache. https://travis-ci.org/rspec/rspec-rails/jobs/476497133

Maybe in downgrading bundler version we should uninstall all versions then install 1.7.3

@benoittgt
Copy link
Member

I just saw that you do it.. gem uninstall -aIx bundler

@JonRowe JonRowe force-pushed the update-travis-build-scripts-2019-01-03-for-master branch 2 times, most recently from 946e792 to 1e26b28 Compare January 8, 2019 13:03
@benoittgt
Copy link
Member

🤔
screenshot 2019-01-08 at 17 42 43

Maybe we should add logs to see which bundler is used?
Since rubygems 3.0.0 we can also do

$ gem info -a bundler                                                                                                      [17:51:45]

*** LOCAL GEMS ***

bundler (1.17.3, 1.17.2)
    Authors: André Arko, Samuel Giddins, Colby Swandale, Hiroshi
    Shibata, David Rodríguez, Grey Baker, Stephanie Morillo, Chris
    Morris, James Wen, Tim Moore, André Medeiros, Jessica Lynn Suttles,
    Terence Lee, Carl Lerche, Yehuda Katz
    Homepage: http://bundler.io
    License: MIT
    Installed at (1.17.3, default): /Users/benoit.tigeot/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0
                 (1.17.2): /Users/benoit.tigeot/.rvm/gems/ruby-2.5.1

    The best way to manage your application's dependencies

@benoittgt benoittgt dismissed their stale review January 8, 2019 16:57

No more blocking on my side. We need change CI state

@JonRowe JonRowe force-pushed the update-travis-build-scripts-2019-01-03-for-master branch from 1a9661d to bf41d9c Compare January 8, 2019 20:44
@benoittgt
Copy link
Member

Thanks for the patch. I am wondering if it is related to:

The version of Bundler in the BUNDLED WITH section is read by Bundler to determine which version of Bundler should run. Using the example lock above, Bundler 1 will be used, as you can see here: (source)

But we don't have Gemfile.lock..

Other scenario could be to declare the bundler version we want to use with bundle _1.17.3_ install but I hope your last patch will work.

@JonRowe
Copy link
Member Author

JonRowe commented Jan 8, 2019

I believe it's because Travis uses rvm and it has bundler 2 on Ruby 2.3 by default as a globally installed gem, picking the bundler version manually should also work but I'd rather actually uninstall it if I can

@benoittgt
Copy link
Member

benoittgt commented Jan 8, 2019

Ok it seems it is not working. Maybe we can try this ugly hack 😞
travis-ci/travis-ci#8717 (comment)


Edit1: I saw some people moving from what you did to rvm @global do gem uninstall bundler -a -x -I || true to travis-ci/travis-ci#8717 (comment)

@JonRowe JonRowe force-pushed the update-travis-build-scripts-2019-01-03-for-master branch from bf41d9c to b64cd41 Compare January 8, 2019 21:25
Copy link
Member

@benoittgt benoittgt left a comment

Choose a reason for hiding this comment

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

Sound good for the moment. Congratulations Jon!

@JonRowe JonRowe merged commit 72d00ef into master Jan 9, 2019
@JonRowe JonRowe deleted the update-travis-build-scripts-2019-01-03-for-master branch January 9, 2019 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants