Skip to content

Upgrading Ruby

JoelRobinson-Tista edited this page Jul 29, 2021 · 2 revisions

The following represents how we upgraded from Ruby 2.5.3 to 2.7.3. This can be used as a framework for future upgrades.

Steps taken to upgrade/get PR ready

  1. Updated version numbers in config files

    • .circleci/config.yml
    • .ruby-version
    • Dockerfile
    • ci-bin/circle_docker_container/Dockerfile
    • ci-bin/circle_docker_container/build_and_push.sh
  2. Updated circle config.yml to install bundler based on version that is in lock file:

- run:
    name: Configure Bundler
    command: |
      echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
      source $BASH_ENV
      gem install bundler
  1. Ran through local upgrade commands:
brew update && brew upgrade ruby-build && rbenv install 2.7.3
gem install bundler
bundle update --bundler
  1. Uploaded new image to AWS

    • Build/push new docker image from ci-bin/circle_docker_container/Dockerfile. Commands:
    mfa XXXXXX
    
    aws ecr get-login-password --region us-gov-west-1 | docker login --username AWS --password-stdin 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com
    
    # following commands ran from ci-bin/circle_docker_container
    
    aws s3 cp s3://shared-s3/dsva-appeals/instant-client-12-1.tar.gz instant-client-12-1.tar.gz
    tar xvzf instant-client-12-1.tar.gz
    rm instant-client-12-1.tar.gz
    
    docker build -t circleci .
    docker tag circleci:latest 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/circleci:2.7.3-node-browsers
    docker push 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/circleci:2.7.3-node-browsers
    
  2. PR created

  3. Test on UAT

After merge, to get dev env up to date

Anyone that doesn't have 2.7 installed locally will have to run the following:

rbenv install
gem install bundler -v 2.2.19
make install

Steps needed to get the continer used in Caseflow Demo working

  1. Update the base image to ruby:2.7.3-slim
  2. The default version's of bundler and rake were in conflict with the Gemfile.lock and needed to be changed in the Dockerfile
    • Install the bundler version used in Gemfile.lock
    • Rake 13.0.1 is already installed, so we're uninstalling it and letting bundler install rake later.
gem install bundler:$(cat Gemfile.lock | tail -1 | tr -d " ")
gem uninstall -i /usr/local/lib/ruby/gems/2.7.0 rake
Clone this wiki locally