summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/seed.rake
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/gitlab/seed.rake')
-rw-r--r--lib/tasks/gitlab/seed.rake35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/seed.rake b/lib/tasks/gitlab/seed.rake
index 36761165af5..7b9c57b1876 100644
--- a/lib/tasks/gitlab/seed.rake
+++ b/lib/tasks/gitlab/seed.rake
@@ -35,5 +35,40 @@ namespace :gitlab do
puts "\n#{issues_created} issues created!"
end
end
+
+ task :epics, [:group_full_path, :backfill_weeks, :average_issues_per_week] => :environment do |t, args|
+ args.with_defaults(backfill_weeks: 5, average_issues_per_week: 2)
+
+ groups =
+ if args.group_full_path
+ group = Group.find_by_full_path(args.group_full_path)
+
+ unless group
+ error_message = "Group '#{args.group_full_path}' does not exist!"
+ potential_groups = Group.search(args.group_full_path)
+
+ if potential_groups.present?
+ error_message += " Did you mean '#{potential_groups.first.full_path}'?"
+ end
+
+ puts error_message.color(:red)
+ exit 1
+ end
+
+ [group]
+ else
+ Group.not_mass_generated.find_each
+ end
+
+ groups.each do |group|
+ puts "\nSeeding epics for the '#{group.full_path}' group"
+ seeder = Quality::Seeders::Epics.new(group: group)
+ epics = seeder.seed(
+ backfill_weeks: args.backfill_weeks.to_i,
+ average_issues_per_week: args.average_issues_per_week.to_i
+ )
+ puts "\n#{epics} epics created!"
+ end
+ end
end
end