From 7d6bb533356eddc12ed320726c102b396988c6f0 Mon Sep 17 00:00:00 2001 From: Jim Bailey Date: Tue, 10 Oct 2023 14:35:40 +0100 Subject: [PATCH] MAP-359: Upgrade Ruby to 3.2.2 --- .circleci/config.yml | 2 +- .env.example | 3 +++ .ruby-version | 2 +- Dockerfile | 6 +++--- Gemfile.lock | 6 +++--- app/models/move.rb | 4 ++-- config/initializers/gov_uk_notify.rb | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1e8ee0366..e186b92b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -276,7 +276,7 @@ executors: test-executor: docker: # Check https://circleci.com/docs/2.0/language-ruby/ for more details - - image: circleci/ruby:2.7.3 + - image: circleci/ruby:3.2.2 environment: BUNDLER_VERSION: 2.1.4 RAILS_ENV: test diff --git a/.env.example b/.env.example index 1bb80cefe..454ee2ae6 100644 --- a/.env.example +++ b/.env.example @@ -18,3 +18,6 @@ GOVUK_NOTIFY_TEMPLATE_ID=8f2e5473-15f2-4db8-a2de-153f26a0524c # Completely disable API authentication for local development if true. DEV_DISABLE_AUTH=false + +# Stop Postgres segfaulting on Ruby 3.x on Mac +PGGSSENCMODE="disable" \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index 2c9b4ef42..be94e6f53 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.3 +3.2.2 diff --git a/Dockerfile b/Dockerfile index 61ebe17b5..3221c0d19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.7.3-alpine as build-stage +FROM ruby:3.2.2-alpine as build-stage ENV RAILS_ENV=production ENV RACK_ENV=production @@ -18,7 +18,7 @@ RUN bundle install --jobs 4 --retry 3 \ && find /usr/local/bundle/gems/ -name "*.o" -delete ############### End of Build step ############### -FROM ruby:2.7.3-alpine as swagger-build +FROM ruby:3.2.2-alpine as swagger-build WORKDIR /app RUN apk --update --no-cache add git build-base postgresql-dev shared-mime-info gcompat tzdata @@ -31,7 +31,7 @@ COPY . /app RUN SKIP_MAINTAIN_TEST_SCHEMA=true rails rswag:specs:swaggerize ############### End of Build step ############### -FROM ruby:2.7.3-alpine +FROM ruby:3.2.2-alpine ARG APP_BUILD_DATE ENV APP_BUILD_DATE ${APP_BUILD_DATE} diff --git a/Gemfile.lock b/Gemfile.lock index a747fd0ba..c4e806dea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -159,7 +159,7 @@ GEM ffi (1.15.5) fiber-annotation (0.2.0) fiber-local (1.0.0) - finite_machine (0.14.0) + finite_machine (0.14.1) concurrent-ruby (~> 1.0) sync (~> 0.5) flipper (0.28.3) @@ -267,7 +267,7 @@ GEM parallel (1.23.0) parser (3.2.2.1) ast (~> 2.4.1) - pg (1.5.3) + pg (1.5.4) prometheus-client (4.2.1) protocol-hpack (1.4.2) protocol-http (0.24.4) @@ -530,7 +530,7 @@ DEPENDENCIES validate_url RUBY VERSION - ruby 2.7.3p183 + ruby 3.2.2p53 BUNDLED WITH 2.1.4 diff --git a/app/models/move.rb b/app/models/move.rb index 1e68b4d7c..475bec6f4 100644 --- a/app/models/move.rb +++ b/app/models/move.rb @@ -170,8 +170,8 @@ def cancel(cancellation_reason:, cancellation_reason_comment: nil) state_machine.cancel end - def cancel!(args) - cancel(args) + def cancel!(**args) + cancel(**args) save! end diff --git a/config/initializers/gov_uk_notify.rb b/config/initializers/gov_uk_notify.rb index 2546db04e..8889f189d 100644 --- a/config/initializers/gov_uk_notify.rb +++ b/config/initializers/gov_uk_notify.rb @@ -4,7 +4,7 @@ %w[GOVUK_NOTIFY_API_KEY GOVUK_NOTIFY_MOVE_TEMPLATE_ID GOVUK_NOTIFY_PER_TEMPLATE_ID].each do |name| if ENV[name].blank? Rails.logger.warn("#{name} env var is not set; emails cannot be sent") - Sentry.capture_message("#{name} env var is not set; emails cannot be sent", { level: 'warning' }) + Sentry.capture_message("#{name} env var is not set; emails cannot be sent", level: 'warning') end end