Skip to content

Work around frozen string Ruby 2.7 bug in slug generation

Stan Hu requested to merge sh-ensure-unfrozen-slug into master

What does this MR do and why?

!117433 (merged) caused the slugified variable to be frozen in Ruby 2.7 when the "env-" prefixed were added. The following script prints true in Ruby 2.7 but false in Ruby 3.0+.

# frozen_string_literal: true

foo = "9-staging-123-q517sa"
foo = "env-#{foo}"

puts foo.frozen?

To preserve Ruby 2.7 compatibiliity, ensure the return string is unfrozen via the + operator.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports