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

Upgrade to Rails 6.1 / Ruby 2.7 #663

Merged
merged 23 commits into from
Nov 22, 2023
Merged

Conversation

Fryguy
Copy link
Member

@Fryguy Fryguy commented Nov 21, 2023

This makes a lot more sense if we go commit by commit.

I can pull some of these out as separate PRs to make this easier.

@bdunne @jrafanie I'd like your thoughts on how to move forward.

I tried to get to Ruby 3, but the hard part is actually upgrading faraday, because the specs mess around with the guts of faraday which have changed.

@miq-bot miq-bot added the wip label Nov 21, 2023
@Fryguy Fryguy added enhancement dependencies Pull requests that update a dependency file labels Nov 21, 2023
@@ -39,5 +39,4 @@
# Ignore local seeds file
db/seeds.local.rb

# Ignore vagrant configuration/runtime files
.vagrant/
/config/master.key
Copy link
Member Author

Choose a reason for hiding this comment

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

This is something I think we need to put in as a secret in kube that maps to this location, and I guess keep in our vault separately.

gem 'sync', :require => false # required by more_core_extensions
gem 'rugged', :require => false
gem 'minigit', '~> 0.0.4'
gem 'net-ssh', '~> 7.2.0'
Copy link
Member Author

@Fryguy Fryguy Nov 21, 2023

Choose a reason for hiding this comment

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

We can probably drop the ~> here or use >=

Copy link
Member

Choose a reason for hiding this comment

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

wow, that's a version bump. 😉

Copy link
Member

@jrafanie jrafanie left a comment

Choose a reason for hiding this comment

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

A few comments. Looks good so far.

gem 'sync', :require => false # required by more_core_extensions
gem 'rugged', :require => false
gem 'minigit', '~> 0.0.4'
gem 'net-ssh', '~> 7.2.0'
Copy link
Member

Choose a reason for hiding this comment

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

wow, that's a version bump. 😉

include Sidekiq::Worker
sidekiq_options :queue => :miq_bot
module PullRequestMonitorHandlers
class MergeTargetTitler
Copy link
Member

Choose a reason for hiding this comment

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

oh ruby and collapsed namespacing random bugs it causes

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually don't think this was related. This was because of that eager load thing. Even so, I want to keep this, since it was the only outlier.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it might not have been the cause this time but it certainly can cause weird constant lookup strangeness.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
Copy link
Member

Choose a reason for hiding this comment

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

Were systemd and vagrant setups we wanted to resurrect later? Maybe systemd?

Copy link
Member Author

Choose a reason for hiding this comment

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

No I don't think so, but git is forever :)


puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
Copy link
Member

Choose a reason for hiding this comment

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

Curiosity. I don't see a commit title related to this change, is this just normalizing bin/setup to what we've done elsewhere or is it solving a problem you hit in the upgrade?

Copy link
Member Author

Choose a reason for hiding this comment

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

Normalizing to the default bin/setup.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually most of this is the default Rails file - only the part about database.yml.sample was normalizing.

Copy link
Member

Choose a reason for hiding this comment

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

cool, it wasn't clear if you just took the defaults and changed them after or left them as is. 👍

@@ -1,4 +1,6 @@
# Be sure to restart your server when you modify this file.

# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
Copy link
Member

Choose a reason for hiding this comment

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

is it intentional to drop :password from this list? Not sure if this is rails defaults overriding our values.

Copy link
Member Author

Choose a reason for hiding this comment

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

filter parameters are substring match, so passw includes password. This is the same original file, so we didn't "add" password originally as it was the default.

@jrafanie
Copy link
Member

Can you update the CI ruby to test against 2.7?

config.eager_load = true
config.eager_load = false
Copy link
Member Author

Choose a reason for hiding this comment

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

@jrafanie 😭

Gemfile.lock Show resolved Hide resolved
Gemfile.lock Show resolved Hide resolved
@Fryguy
Copy link
Member Author

Fryguy commented Nov 21, 2023

Can you update the CI ruby to test against 2.7?

Done.

@Fryguy
Copy link
Member Author

Fryguy commented Nov 21, 2023

Tests are failing because rails db:prepare doesn't seem to be doing what it's supposed to do on CI - I'll dig in.

Comment on lines +26 to +28
if ENV["CI"]
system! 'RAILS_ENV=test bin/rails db:prepare'
else
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure why we need this - feels like a bug in Rails, but it's fine for now.

@jrafanie
Copy link
Member

Bump tp Ruby 2.7 for GHA

noticed this typo in the commit message

@jrafanie
Copy link
Member

jrafanie commented Nov 21, 2023

Tests are failing because rails db:prepare doesn't seem to be doing what it's supposed to do on CI - I'll dig in.

Hmmm, is it possible it's trying to load from schema.rb?

@miq-bot
Copy link
Member

miq-bot commented Nov 22, 2023

Checked commits Fryguy/miq_bot@2b0cea1~...68b775b with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint
38 files checked, 16 offenses detected

**

  • 💣 💥 🔥 🚒 - Linter/Yaml - missing config files

config/application.rb

config/environments/development.rb

config/environments/production.rb

config/initializers/session_store.rb

config/initializers/wrap_parameters.rb

config/puma.rb

lib/git_service/branch.rb

spec/models/batch_job_spec.rb

@Fryguy Fryguy changed the title [WIP] Upgrade to Rails 6.1 / Ruby 2.7 Upgrade to Rails 6.1 / Ruby 2.7 Nov 22, 2023
@miq-bot miq-bot removed the wip label Nov 22, 2023
@bdunne bdunne merged commit 3e28293 into ManageIQ:master Nov 22, 2023
2 checks passed
@Fryguy Fryguy deleted the rails6_ruby27 branch November 22, 2023 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants