Rails 7 upgrade

I took the liberty to poke packaging:

There is an all-in-one copr at:
https://copr.fedorainfracloud.org/coprs/evgeni/rails70/

1 Like

During today’s session @ofedoren shared that he thinks we’ve pretty much done all we can and are now mostly blocked by plugin owners.

In Fixes #37997 - Support Rails 7.0 by ofedoren Ā· Pull Request #644 Ā· theforeman/foreman_discovery Ā· GitHub there’s a small change that waits for an entry to be present. We also saw that was needed somewhere else so it’s a question whether the application got slower or if this is just something in the test stack. It could even be that the test stack got faster, uncovering a race condition. We don’t have good infrastructure to test this on production builds. @ekohl made a note to speak to Red Hat’s performance team to see what they have.

Then there’s the change in Rails 7 defaults: it changes the default hashing algorithm from SHA1 to SHA256: Fixes #37825 - Upgrade Rails to 7.0 by ofedoren Ā· Pull Request #10299 Ā· theforeman/foreman Ā· GitHub. According to Rails’ notes this impacts various things like caching, cookies, encrypted messages and etags. Those are probably not an issue for us, but something we need to keep an eye on and include a release note that users will be logged out when upgrading. We may want to add tasks to explicitly purge existing sessions and caches just to clean them up. Etags probably don’t affect us since Apache serves the assets and they have a unique timestamp in their filename with a long expiration time, so we don’t rely on etags.

It may be an issue for Katello which uses the hashing to construct Candlepin IDs. It’s unclear to us if this is a concern, but this is where we need the plugin team to weigh in (hello @katello).

Then for foreman_theme_satellite there’s the first big Rails 6.1 vs 7.0 difference: Support Rails 7.0 by ofedoren Ā· Pull Request #97 Ā· RedHatSatellite/foreman_theme_satellite Ā· GitHub. While not required for the upstream community, the people currently working on this effort do care. It’s also worth highlighting it for other plugin authors.

We’ve agreed that the goal for next week is to get in a state where we can build RPMs (even for PRs that aren’t merged) and perform end-to-end testing. The week after we should know pretty well if we’re good to pull the trigger and merge all the patches. So stay tuned for at least the next 2 updates.

Do you mean this SecureRandom.random_number? As long as that syntax isn’t changing, I don’t think it should be an issue.

Quoting the relevant Katello bits from the linked discussion:

This is called later:

Changing how cp_id is generated can have significant implications, but it could also be completely harmless. That’s what we need to figure out.

When creating a Candlepin environment (which corresponds to a Katello content view environment) we do this:

which calls katello/app/lib/katello/resources/candlepin/environment.rb at a444a646bf3bfa326d563edd894574f1df176159 Ā· Katello/katello Ā· GitHub

which calls Candlepin’s API POST /owners/{owner_key}/environments and feeds Candlepin whatever ID we generated. Candlepin just saves the object with the ID we give it.

On my system it creates IDs that look like this:

Katello::ContentViewEnvironment.all
=> [#<Katello::ContentViewEnvironment:0x00007f85b9bd58d0
  id: 1,
  name: "Library",
  label: "Library",
  cp_id: "64c2cce3716a5bf67b0413fac95e5daa",
  content_view_id: 1,
  created_at: Wed, 06 Nov 2024 16:30:22.091071000 UTC +00:00,
  updated_at: Wed, 06 Nov 2024 16:30:22.091071000 UTC +00:00,
  environment_id: 1,
  content_view_version_id: 1>,
 #<Katello::ContentViewEnvironment:0x00007f85b9b97670
  id: 2,
  name: "Library/cv1",
  label: "Library/cv1",
  cp_id: "380e1992321843ee64331a37f9a440a2",
  content_view_id: 2,
  created_at: Tue, 12 Nov 2024 13:04:03.211110000 UTC +00:00,
  updated_at: Tue, 12 Nov 2024 13:07:24.883810000 UTC +00:00,
  environment_id: 1,
  content_view_version_id: 3>]

So I don’t immediately foresee any problems, unless I’m missing something. Will double-check with other Katello folks too.

That’s sort of what I expected, but if they’re opaque IDs, would it be better to use UUIDs?

So as long as we can create a digest or key based of name and id we should be ok. The cp_ids used to be random numbers before and then got changed to a computed value when it was impacting vcr tests. ( look at Fixes #19099 - Use consistent candlepin requests by jlsherrill Ā· Pull Request #6717 Ā· Katello/katello Ā· GitHub )

2 Likes

Going over the board we have a few issues in progress.

Most notable is Katello. There was a follow up of the above discussion and that needs to be reflected. To make packaging easier we briefly talked about the angular-rails-templates dependency. During the meeting we weren’t sure if it should be split off, but since I’ve decided that’s best. Fixes #38018 - Rails 7 compatible angular-rails-templates by ekohl Ā· Pull Request #11222 Ā· Katello/katello Ā· GitHub has already been merged and Refs #38018 - Update Katello's angular-rails-templates version by ekohl Ā· Pull Request #11489 Ā· theforeman/foreman-packaging Ā· GitHub should be done soon as well. That means we can just update it in nightly and not maintain it as a separate build in our COPR.

Then Fixes #37848 - Support Rails 7.0 by ofedoren Ā· Pull Request #739 Ā· theforeman/foreman_ansible Ā· GitHub & Fixes #37991 - Support Rails 7.0 by ofedoren Ā· Pull Request #78 Ā· theforeman/foreman_google Ā· GitHub can both be merged & released and by the time I write these notes they’re already merged. Again, having those in nightly simplifies testing.

Then there’s the core PR. Foreman itself (including develop) is currently red and Fixes #38017 - Update libvirt gems & fix tests by stejskalleos Ā· Pull Request #10377 Ā· theforeman/foreman Ā· GitHub aims to resolve that.

Our aim is to get anything that can be merged & released in nightly by tomorrow. Then we just have Foreman, Rails itself and possibly Katello. That should simplify end-to-end testing. We aim to get a good answer on that before next week’s meeting. If all goes well, we can press the big green buttons then.

We will need help from @katello to get Refs #38018 - Update Katello's angular-rails-templates version by ekohl Ā· Pull Request #11489 Ā· theforeman/foreman-packaging Ā· GitHub reviewed. Additionally, @lstejska is already working on the foreman_ansible & foreman_google tasks.

In the past week @ofedoren found that the constraints we had set on routes in foreman_ansible and foreman_openscap in the past weren’t quite right. By now he found the fix:

The Katello update PR has been split and all compatible preparations have been merged while the main PR has been ACKed.

For various reasons Katello nightly hasn’t been updated since 4.15 branched and we’re currently working on getting that green. That allows us to get all changed merged & released.

The current goal is to make sure that by Thursday all preparation changes are available in nightly. By then we should also update evgeni/rails70 Copr to include patched Foreman and Katello RPMs to perform end-to-end testing. Then by next week’s meeting we should be ready to plan the actual merge.

1 Like

Last week we finally got nightly green again, which means updates are properly flowing again. The goal for this week is to make sure all changes make it into releases where possible and build a copr repository with those that can’t (Foreman & Katello). @ofedoren will make sure we know which releases are missing and ping people where possible while @ekohl takes care of the latter. Once we have that, @ekohl will post testing instructions here so we can take it for a spin before merging all changes.

4 Likes

We made changes and even though we didn’t manage to completely end-to-end test with packages, we feel confident enough to merge:

Goal is to get this all stable before the holidays, which for some means it needs to happen this week.

2 Likes

I’m going to mark this as resolved since it’s been merged to nightly and nightly has been passing since. While some plugins may still need work, it’s IMHO separate from the main effort now.

Can you still post what the first Foreman/Katello version to use Rails 7 will be?

Current nightly, which will be Foreman 3.14 and Katello 4.16.

1 Like