Merge branch 'zj-environment-creation-regex-fix' into 'master'
Replace invalid chars while seeding environments Closes #30855 See merge request !12267
This commit is contained in:
commit
4e8d6507bf
|
@ -33,7 +33,7 @@ class Gitlab::Seeder::Environments
|
|||
|
||||
create_deployment!(
|
||||
merge_request.source_project,
|
||||
"review/#{merge_request.source_branch}",
|
||||
"review/#{merge_request.source_branch.gsub(/[^a-zA-Z0-9]/, '')}",
|
||||
merge_request.source_branch,
|
||||
merge_request.diff_head_sha
|
||||
)
|
||||
|
|
|
@ -43,7 +43,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def environment_name_regex_message
|
||||
"can contain only letters, digits, '-', '_', '/', '$', '{', '}', '.' and spaces"
|
||||
"can contain only letters, digits, '-', '_', '/', '$', '{', '}', '.', and spaces"
|
||||
end
|
||||
|
||||
def kubernetes_namespace_regex
|
||||
|
|
|
@ -20,6 +20,18 @@ describe Gitlab::Regex, lib: true do
|
|||
it { is_expected.to match('foo@bar') }
|
||||
end
|
||||
|
||||
describe '.environment_slug_regex' do
|
||||
subject { described_class.environment_name_regex }
|
||||
|
||||
it { is_expected.to match('foo') }
|
||||
it { is_expected.to match('foo-1') }
|
||||
it { is_expected.to match('FOO') }
|
||||
it { is_expected.to match('foo/1') }
|
||||
it { is_expected.to match('foo.1') }
|
||||
it { is_expected.not_to match('9&foo') }
|
||||
it { is_expected.not_to match('foo-^') }
|
||||
end
|
||||
|
||||
describe '.environment_slug_regex' do
|
||||
subject { described_class.environment_slug_regex }
|
||||
|
||||
|
|
Loading…
Reference in New Issue