提交 5eb940da 编写于 作者: Z Zeger-Jan van de Weg 提交者: Grzegorz Bizon

Replace invalid chars while seeding environments

上级 6a3da45a
......@@ -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 }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册