Skip to content

Commit 77fa558

Browse files
authored
Merge pull request rails#48015 from rails/fix-trilogy-builds-retry
Fix trilogy builds
2 parents 40f6c12 + 5aabcba commit 77fa558

File tree

8 files changed

+250
-631
lines changed

8 files changed

+250
-631
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ platforms :ruby, :windows do
150150
group :db do
151151
gem "pg", "~> 1.3"
152152
gem "mysql2", "~> 0.5"
153-
gem "trilogy", "~> 2.4"
153+
gem "trilogy", github: "github/trilogy", branch: "main", glob: "contrib/ruby/*.gemspec"
154154
end
155155
end
156156

Gemfile.lock

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
GIT
2+
remote: https://github.com/github/trilogy.git
3+
revision: 8e4ae98569c12894da9bcbee5edb32b76068dbfd
4+
branch: main
5+
glob: contrib/ruby/*.gemspec
6+
specs:
7+
trilogy (2.4.0)
8+
19
GIT
210
remote: https://github.com/matthewd/websocket-client-simple.git
311
revision: e161305f1a466b9398d86df3b1731b03362da91b
@@ -338,9 +346,13 @@ GEM
338346
net-smtp (0.3.3)
339347
net-protocol
340348
nio4r (2.5.8)
341-
nokogiri (1.13.10)
349+
nokogiri (1.14.3)
342350
mini_portile2 (~> 2.8.0)
343351
racc (~> 1.4)
352+
nokogiri (1.14.3-x86_64-darwin)
353+
racc (~> 1.4)
354+
nokogiri (1.14.3-x86_64-linux)
355+
racc (~> 1.4)
344356
os (1.1.4)
345357
parallel (1.22.1)
346358
parser (3.2.1.1)
@@ -486,8 +498,10 @@ GEM
486498
actionpack (>= 5.2)
487499
activesupport (>= 5.2)
488500
sprockets (>= 3.0.0)
489-
sqlite3 (1.5.4)
501+
sqlite3 (1.6.2)
490502
mini_portile2 (~> 2.8.0)
503+
sqlite3 (1.6.2-x86_64-darwin)
504+
sqlite3 (1.6.2-x86_64-linux)
491505
stackprof (0.2.23)
492506
stimulus-rails (1.2.1)
493507
railties (>= 6.0.0)
@@ -507,7 +521,6 @@ GEM
507521
timeout (0.3.2)
508522
tomlrb (2.0.3)
509523
trailblazer-option (0.1.2)
510-
trilogy (2.4.0)
511524
turbo-rails (1.3.2)
512525
actionpack (>= 6.0.0)
513526
activejob (>= 6.0.0)
@@ -619,7 +632,7 @@ DEPENDENCIES
619632
sucker_punch
620633
tailwindcss-rails
621634
terser (>= 1.1.4)
622-
trilogy (~> 2.4)
635+
trilogy!
623636
turbo-rails
624637
tzinfo-data
625638
w3c_validators (~> 1.3.6)

activerecord/Rakefile

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,20 @@ end
209209

210210
namespace :db do
211211
namespace :mysql do
212-
connection_arguments = lambda do |connection_name|
213-
config = ARTest.config["connections"]["mysql2"][connection_name]
214-
["--user=#{config["username"]}", ("--password=#{config["password"]}" if config["password"]), ("--host=#{config["host"]}" if config["host"]), ("--socket=#{config["socket"]}" if config["socket"])].join(" ")
212+
mysql2_config = ARTest.config["connections"]["mysql2"]
213+
mysql2_connection_arguments = lambda do |connection_name|
214+
mysql2_connection = mysql2_config[connection_name]
215+
["--user=#{mysql2_connection["username"]}", ("--password=#{mysql2_connection["password"]}" if mysql2_connection["password"]), ("--host=#{mysql2_connection["host"]}" if mysql2_connection["host"]), ("--socket=#{mysql2_connection["socket"]}" if mysql2_connection["socket"])].join(" ")
215216
end
216217

218+
trilogy_config = ARTest.config["connections"]["trilogy"]
219+
trilogy_connection_arguments = lambda do |connection_name|
220+
trilogy_connection = trilogy_config[connection_name]
221+
["--user=#{trilogy_connection["username"]}", ("--password=#{trilogy_connection["password"]}" if trilogy_connection["password"]), ("--host=#{trilogy_connection["host"]}" if trilogy_connection["host"]), ("--socket=#{trilogy_connection["socket"]}" if trilogy_connection["socket"])].join(" ")
222+
end
223+
224+
mysql_configs = [mysql2_config, trilogy_config]
225+
217226
desc "Create the MySQL Rails User"
218227
task :build_user do
219228
if ENV["MYSQL_CODESPACES"]
@@ -226,26 +235,30 @@ namespace :db do
226235
mysql_command = "mysql -uroot -e"
227236
end
228237

229-
config = ARTest.config["connections"]["mysql2"]
230-
%x( #{mysql_command} "CREATE USER IF NOT EXISTS '#{config["arunit"]["username"]}'@'localhost';" )
231-
%x( #{mysql_command} "CREATE USER IF NOT EXISTS '#{config["arunit2"]["username"]}'@'localhost';" )
232-
%x( #{mysql_command} "GRANT ALL PRIVILEGES ON #{config["arunit"]["database"]}.* to '#{config["arunit"]["username"]}'@'localhost'" )
233-
%x( #{mysql_command} "GRANT ALL PRIVILEGES ON #{config["arunit2"]["database"]}.* to '#{config["arunit2"]["username"]}'@'localhost'" )
234-
%x( #{mysql_command} "GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* to '#{config["arunit"]["username"]}'@'localhost';" )
238+
mysql_configs.each do |config|
239+
%x( #{mysql_command} "CREATE USER IF NOT EXISTS '#{config["arunit"]["username"]}'@'localhost';" )
240+
%x( #{mysql_command} "CREATE USER IF NOT EXISTS '#{config["arunit2"]["username"]}'@'localhost';" )
241+
%x( #{mysql_command} "GRANT ALL PRIVILEGES ON #{config["arunit"]["database"]}.* to '#{config["arunit"]["username"]}'@'localhost'" )
242+
%x( #{mysql_command} "GRANT ALL PRIVILEGES ON #{config["arunit2"]["database"]}.* to '#{config["arunit2"]["username"]}'@'localhost'" )
243+
%x( #{mysql_command} "GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* to '#{config["arunit"]["username"]}'@'localhost';" )
244+
end
235245
end
236246

237247
desc "Build the MySQL test databases"
238248
task build: ["db:mysql:build_user"] do
239-
config = ARTest.config["connections"]["mysql2"]
240-
%x( mysql #{connection_arguments["arunit"]} -e "create DATABASE #{config["arunit"]["database"]} DEFAULT CHARACTER SET utf8mb4" )
241-
%x( mysql #{connection_arguments["arunit2"]} -e "create DATABASE #{config["arunit2"]["database"]} DEFAULT CHARACTER SET utf8mb4" )
249+
%x( mysql #{mysql2_connection_arguments["arunit"]} -e "create DATABASE IF NOT EXISTS #{mysql2_config["arunit"]["database"]} DEFAULT CHARACTER SET utf8mb4" )
250+
%x( mysql #{mysql2_connection_arguments["arunit2"]} -e "create DATABASE IF NOT EXISTS #{mysql2_config["arunit2"]["database"]} DEFAULT CHARACTER SET utf8mb4" )
251+
%x( mysql #{trilogy_connection_arguments["arunit"]} -e "create DATABASE IF NOT EXISTS #{trilogy_config["arunit"]["database"]} DEFAULT CHARACTER SET utf8mb4" )
252+
%x( mysql #{trilogy_connection_arguments["arunit2"]} -e "create DATABASE IF NOT EXISTS #{trilogy_config["arunit2"]["database"]} DEFAULT CHARACTER SET utf8mb4" )
242253
end
243254

244255
desc "Drop the MySQL test databases"
245256
task :drop do
246-
config = ARTest.config["connections"]["mysql2"]
247-
%x( mysqladmin #{connection_arguments["arunit"]} -f drop #{config["arunit"]["database"]} )
248-
%x( mysqladmin #{connection_arguments["arunit2"]} -f drop #{config["arunit2"]["database"]} )
257+
%x( mysql #{mysql2_connection_arguments["arunit"]} -e "drop database IF EXISTS #{mysql2_config["arunit"]["database"]}" )
258+
%x( mysql #{mysql2_connection_arguments["arunit2"]} -e "drop database IF EXISTS #{mysql2_config["arunit2"]["database"]}" )
259+
260+
%x( mysql #{trilogy_connection_arguments["arunit"]} -e "drop database IF EXISTS #{trilogy_config["arunit"]["database"]}" )
261+
%x( mysql #{trilogy_connection_arguments["arunit2"]} -e "drop database IF EXISTS #{trilogy_config["arunit2"]["database"]}" )
249262
end
250263

251264
desc "Rebuild the MySQL test databases"

0 commit comments

Comments
 (0)