Skip to content
Snippets Groups Projects
Commit 5eb940da authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg Committed by Grzegorz Bizon
Browse files

Replace invalid chars while seeding environments

parent 6a3da45a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment