Commit fa6ef455 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'make-sure-env-name-not-ending-in-slash' into 'master'

Avoid building potential invalid environment name while seeding

See merge request gitlab-org/gitlab-ce!20523
parents 5f12cdf5 cf777261
......@@ -30,14 +30,14 @@ class Gitlab::Seeder::Environments
def create_merge_request_review_deployments!
@project
.merge_requests
.select { |mr| mr.source_branch.match(/\p{Alnum}+/) }
.select { |mr| mr.source_branch.match(/[^a-zA-Z0-9]+/) }
.sample(4)
.each do |merge_request|
next unless merge_request.diff_head_sha
create_deployment!(
merge_request.source_project,
"review/#{merge_request.source_branch.gsub(/[^a-zA-Z0-9]/, '')}",
"review/#{merge_request.source_branch.gsub(/[^a-zA-Z0-9]+/, '')}",
merge_request.source_branch,
merge_request.diff_head_sha
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment