Skip to content

Fix YAML alias usage for ruby 3.1

What does this MR do and why?

As also seen in gitlab-org/gitlab#396231 (closed) we need to enable aliases explicitly for them to work in Ruby 3.1+.

Otherwise the gem will generate an error like this:

Click to expand
/opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:432:in `visit_Psych_Nodes_Alias': Alias parsing was not enabled. To enable it, pass `aliases: true` to `Psych::load` or `Psych::safe_load`. (Psych::AliasesNotEnabled)
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:347:in `block in revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each_slice'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:169:in `visit_Psych_Nodes_Mapping'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:347:in `block in revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each_slice'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:169:in `visit_Psych_Nodes_Mapping'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:340:in `block in register_empty'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:340:in `each'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:340:in `register_empty'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:148:in `visit_Psych_Nodes_Sequence'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:347:in `block in revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each_slice'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:169:in `visit_Psych_Nodes_Mapping'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:347:in `block in revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each_slice'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:169:in `visit_Psych_Nodes_Mapping'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:347:in `block in revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each_slice'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `revive_hash'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:169:in `visit_Psych_Nodes_Mapping'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:320:in `visit_Psych_Nodes_Document'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych.rb:334:in `safe_load'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych.rb:369:in `load'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych.rb:671:in `block in load_file'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych.rb:670:in `open'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/psych.rb:670:in `load_file'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/gitlab-triage-1.41.0/bin/gitlab-triage:12:in `block in <top (required)>'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/set.rb:511:in `each_key'
	from /opt/homebrew/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/set.rb:511:in `each'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/gitlab-triage-1.41.0/bin/gitlab-triage:11:in `<top (required)>'
	from /opt/homebrew/lib/ruby/gems/3.2.0/bin/gitlab-triage:25:in `load'
	from /opt/homebrew/lib/ruby/gems/3.2.0/bin/gitlab-triage:25:in `<main>'

Merge request reports