From 95457b8208efc63edfd077922696fe2b3bb1da53 Mon Sep 17 00:00:00 2001 From: Riccardo Carlesso Date: Thu, 19 Mar 2026 09:29:03 +0100 Subject: [PATCH] fix(appengine): modernize rails-cloudsql gae flex ruby examples --- .toys/kokoro-ci.rb | 12 ++++++++++-- appengine/rails-cloudsql-mysql/Gemfile | 1 + appengine/rails-cloudsql-mysql/app.yaml | 2 ++ appengine/rails-cloudsql-postgres/Gemfile | 1 + appengine/rails-cloudsql-postgres/app.yaml | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.toys/kokoro-ci.rb b/.toys/kokoro-ci.rb index 7659846b6..ebe1a51f2 100644 --- a/.toys/kokoro-ci.rb +++ b/.toys/kokoro-ci.rb @@ -153,12 +153,20 @@ def filter_by_ruby_versions @products.delete "spanner" # run/rails uses Rails 7 and requires newest Ruby. @products.delete "run/rails" + # Rails 7 cloud-sql samples require Ruby 3.2+, so run only on newest. + @products.delete "appengine/rails-cloudsql-postgres" + @products.delete "appengine/rails-cloudsql-mysql" end if newest_ruby? # getting-started uses an old Rails and is incompatible with newest. @products.delete_if { |dir| dir.start_with? "getting-started/" } - # appengine tests are slow and some use an old Rails. Run only on oldest. - @products.delete_if { |dir| dir.start_with? "appengine/" } + # appengine tests are slow and some use an old Rails. Run only on oldest, + # except for rails-cloudsql which require newest Ruby because they use Rails 7. + @products.delete_if do |dir| + dir.start_with?("appengine/") && + dir != "appengine/rails-cloudsql-postgres" && + dir != "appengine/rails-cloudsql-mysql" + end end end diff --git a/appengine/rails-cloudsql-mysql/Gemfile b/appengine/rails-cloudsql-mysql/Gemfile index a0586e4d2..7f69b9114 100644 --- a/appengine/rails-cloudsql-mysql/Gemfile +++ b/appengine/rails-cloudsql-mysql/Gemfile @@ -13,6 +13,7 @@ # limitations under the License. source "https://rubygems.org" +ruby ">= 3.2.0" git_source :github do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include? "/" diff --git a/appengine/rails-cloudsql-mysql/app.yaml b/appengine/rails-cloudsql-mysql/app.yaml index 56879ad60..dee928f50 100644 --- a/appengine/rails-cloudsql-mysql/app.yaml +++ b/appengine/rails-cloudsql-mysql/app.yaml @@ -18,6 +18,8 @@ entrypoint: bundle exec rackup --port $PORT env: flex runtime: ruby +runtime_config: + operating_system: "ubuntu22" # [END step_1] env_variables: diff --git a/appengine/rails-cloudsql-postgres/Gemfile b/appengine/rails-cloudsql-postgres/Gemfile index 67abc5919..10f93103f 100644 --- a/appengine/rails-cloudsql-postgres/Gemfile +++ b/appengine/rails-cloudsql-postgres/Gemfile @@ -13,6 +13,7 @@ # limitations under the License. source "https://rubygems.org" +ruby ">= 3.2.0" git_source :github do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include? "/" diff --git a/appengine/rails-cloudsql-postgres/app.yaml b/appengine/rails-cloudsql-postgres/app.yaml index 56879ad60..dee928f50 100644 --- a/appengine/rails-cloudsql-postgres/app.yaml +++ b/appengine/rails-cloudsql-postgres/app.yaml @@ -18,6 +18,8 @@ entrypoint: bundle exec rackup --port $PORT env: flex runtime: ruby +runtime_config: + operating_system: "ubuntu22" # [END step_1] env_variables: