Commit 43b0dddf authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Fix enviroments seeding on certain branch names

Bit of a cryptic commit title, but our seeding will try to guard against
branchnames being anything but alphanumerical. These charachters we gsub
away but can't have an empty string as replacement.

This change is less efficient, but given that the number of seeded MRs
per project is very limited, this should be ok.
parent 91a3a4b5
...@@ -28,7 +28,11 @@ class Gitlab::Seeder::Environments ...@@ -28,7 +28,11 @@ class Gitlab::Seeder::Environments
end end
def create_merge_request_review_deployments! def create_merge_request_review_deployments!
@project.merge_requests.sample(4).map do |merge_request| @project
.merge_requests
.select { |mr| mr.source_branch.match(/\p{Alnum}+/) }
.sample(4)
.each do |merge_request|
next unless merge_request.diff_head_sha next unless merge_request.diff_head_sha
create_deployment!( create_deployment!(
......
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