Skip to content

Ruby Update

Dani Donisa edited this page Jan 11, 2024 · 12 revisions

Ruby Update

How to make a Ruby version update happening.

⚠️⚠️⚠️ Exchanging the Ruby version is a pretty disruptive change. Make sure people are aware before you disrupt their workday ⚠️⚠️⚠️

Packaging

Ruby Interpreter Package

  • Create a link to the ruby package you want to use from devel:languages:ruby
  • Make sure it builds at least for the distribution we use on production

Project Configuration

There is a ruby configuration section at the bottom of the prjconf. It defines which ruby version the rubygem packages in O:S:U are built for. We only ever build things for one ruby version.

  • Adopt all the versioned macros
  • rebuild of the rubygem packages, make sure they succeed

Staging Project

If you don't want to do all of the above directly in O:S:U you can create a temporary staging project anywhere and do this in there.

<project name="OBS:Server:Unstable:Ruby40">
  <title/>
  <description>Testing the ruby 4.0 update</description>
  <link project="OBS:Server:Unstable"/>
  <repository name="15.3" linkedbuild="all">
    <path project="SUSE:SLE-15-SP3:GA" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
</project>

Code

Interpreter location

Find (grep -Hril ruby.ruby2.5) and replace all interpreter locations you find for the old version with the new version.

Development Environment

Install the new ruby interpreter in your dev-env and try to boot the app. Fix any problems...

docker compose run --rm --service-ports frontend /bin/bash -l
...
frontend@4757397d3caa:/obs/src/api> sudo zypper rm '*ruby*'
# You may need to install the following repo before installing ruby3.1-devel
frontend@4757397d3caa:/obs/src/api> sudo zypper ar -f https://download.opensuse.org/repositories/OBS:/Server:/Unstable:/Ruby31/15.3/OBS:Server:Unstable:Ruby31.repo
frontend@4757397d3caa:/obs/src/api> sudo zypper in ruby3.1-devel
frontend@4757397d3caa:/obs/src/api> bundle.ruby3.1 -v # Set this in Gemfile.lock "BUNDLED WITH"
frontend@4757397d3caa:/obs/src/api> bundle.ruby3.1 install
frontend@4757397d3caa:/obs/src/api> bundle.ruby.ruby3.1 exec rspec

Fix what needs to be fixed.

CI Cycle

Once you are reasonably sure you have a working code base again:

  • adopt the frontend container to use/setup the new Ruby interpreter version.
  • send all your code changes from above as PR and get it merged, the CI will use the adopted container

Deployment

Now comes the tricky part...

OBS packages

Adopt the Ruby interpreter version in

  • dist/obs-server.spec
  • dist/obs-bundled-gems.spec

and make them build.

build-test.opensuse.org

Once obs-api is building, our test instance will automatically install it.

You need to adopt some files:

  • Update the ruby version in /etc/apache2/conf.d/mod_passenger.conf
  • Update the ruby version in /root/.bashrc

Once this works, move on to production.

Productions

Repeat what you had to do on the test instance and deploy everything. Good luck!

Clone this wiki locally