diff options
author | Rémy Coutable <remy@rymai.me> | 2017-04-11 09:26:11 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-04-11 09:26:11 +0000 |
commit | 54b215567ac2cd7af73dd97bf1eaa2cf520b7cad (patch) | |
tree | ae2a0e75efa6ab4a41a1c70c0213d2d852f0f4ae | |
parent | 6975a77e5cd838951efb99348a835cfc415c5281 (diff) | |
parent | d33fc982f554a0c58d19b81f31967134b2140c72 (diff) | |
download | gitlab-ce-54b215567ac2cd7af73dd97bf1eaa2cf520b7cad.tar.gz |
Merge branch 'rs-skip-nested-groups-seed' into 'master'
Move the nested groups seed behind an environment flag
See merge request !10601
-rw-r--r-- | db/fixtures/development/17_cycle_analytics.rb | 6 | ||||
-rw-r--r-- | db/fixtures/development/20_nested_groups.rb | 68 |
2 files changed, 41 insertions, 33 deletions
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb index 4bc735916c1..0d7eb1a7c93 100644 --- a/db/fixtures/development/17_cycle_analytics.rb +++ b/db/fixtures/development/17_cycle_analytics.rb @@ -223,7 +223,9 @@ class Gitlab::Seeder::CycleAnalytics end Gitlab::Seeder.quiet do - if ENV['SEED_CYCLE_ANALYTICS'] + flag = 'SEED_CYCLE_ANALYTICS' + + if ENV[flag] Project.all.each do |project| seeder = Gitlab::Seeder::CycleAnalytics.new(project) seeder.seed! @@ -235,6 +237,6 @@ Gitlab::Seeder.quiet do seeder = Gitlab::Seeder::CycleAnalytics.new(Project.order(:id).first, perf: true) seeder.seed_metrics! else - puts "Not running the cycle analytics seed file. Use the `SEED_CYCLE_ANALYTICS` environment variable to enable it." + puts "Skipped. Use the `#{flag}` environment variable to enable." end end diff --git a/db/fixtures/development/20_nested_groups.rb b/db/fixtures/development/20_nested_groups.rb index d8dddc3fee9..2bc78e120a5 100644 --- a/db/fixtures/development/20_nested_groups.rb +++ b/db/fixtures/development/20_nested_groups.rb @@ -27,43 +27,49 @@ end Sidekiq::Testing.inline! do Gitlab::Seeder.quiet do - project_urls = [ - 'https://android.googlesource.com/platform/hardware/broadcom/libbt.git', - 'https://android.googlesource.com/platform/hardware/broadcom/wlan.git', - 'https://android.googlesource.com/platform/hardware/bsp/bootloader/intel/edison-u-boot.git', - 'https://android.googlesource.com/platform/hardware/bsp/broadcom.git', - 'https://android.googlesource.com/platform/hardware/bsp/freescale.git', - 'https://android.googlesource.com/platform/hardware/bsp/imagination.git', - 'https://android.googlesource.com/platform/hardware/bsp/intel.git', - 'https://android.googlesource.com/platform/hardware/bsp/kernel/common/v4.1.git', - 'https://android.googlesource.com/platform/hardware/bsp/kernel/common/v4.4.git' - ] + flag = 'SEED_NESTED_GROUPS' - user = User.admins.first + if ENV[flag] + project_urls = [ + 'https://android.googlesource.com/platform/hardware/broadcom/libbt.git', + 'https://android.googlesource.com/platform/hardware/broadcom/wlan.git', + 'https://android.googlesource.com/platform/hardware/bsp/bootloader/intel/edison-u-boot.git', + 'https://android.googlesource.com/platform/hardware/bsp/broadcom.git', + 'https://android.googlesource.com/platform/hardware/bsp/freescale.git', + 'https://android.googlesource.com/platform/hardware/bsp/imagination.git', + 'https://android.googlesource.com/platform/hardware/bsp/intel.git', + 'https://android.googlesource.com/platform/hardware/bsp/kernel/common/v4.1.git', + 'https://android.googlesource.com/platform/hardware/bsp/kernel/common/v4.4.git' + ] - project_urls.each_with_index do |url, i| - full_path = url.sub('https://android.googlesource.com/', '') - full_path = full_path.sub(/\.git\z/, '') - full_path, _, project_path = full_path.rpartition('/') - group = Group.find_by_full_path(full_path) || create_group_with_parents(user, full_path) + user = User.admins.first - params = { - import_url: url, - namespace_id: group.id, - path: project_path, - name: project_path, - description: FFaker::Lorem.sentence, - visibility_level: Gitlab::VisibilityLevel.values.sample - } + project_urls.each_with_index do |url, i| + full_path = url.sub('https://android.googlesource.com/', '') + full_path = full_path.sub(/\.git\z/, '') + full_path, _, project_path = full_path.rpartition('/') + group = Group.find_by_full_path(full_path) || create_group_with_parents(user, full_path) - project = Projects::CreateService.new(user, params).execute - project.send(:_run_after_commit_queue) + params = { + import_url: url, + namespace_id: group.id, + path: project_path, + name: project_path, + description: FFaker::Lorem.sentence, + visibility_level: Gitlab::VisibilityLevel.values.sample + } - if project.valid? - print '.' - else - print 'F' + project = Projects::CreateService.new(user, params).execute + project.send(:_run_after_commit_queue) + + if project.valid? + print '.' + else + print 'F' + end end + else + puts "Skipped. Use the `#{flag}` environment variable to enable." end end end |