Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/development/03_project.rb1
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb12
-rw-r--r--db/fixtures/development/33_triage_ops.rb44
-rw-r--r--db/fixtures/development/35_emails.rb55
4 files changed, 108 insertions, 4 deletions
diff --git a/db/fixtures/development/03_project.rb b/db/fixtures/development/03_project.rb
index ae9a17b637c..d1928a9ad82 100644
--- a/db/fixtures/development/03_project.rb
+++ b/db/fixtures/development/03_project.rb
@@ -4,6 +4,7 @@ class Gitlab::Seeder::Projects
include ActionView::Helpers::NumberHelper
PROJECT_URLS = %w[
+ https://gitlab.com/gitlab-com/support/toolbox/gitlab-smoke-tests.git
https://gitlab.com/gitlab-org/gitlab-test.git
https://gitlab.com/gitlab-org/gitlab-shell.git
https://gitlab.com/gnuwget/wget2.git
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index 4f6bfc5c82a..fa890531861 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -50,6 +50,17 @@ class Gitlab::Seeder::CycleAnalytics
end
def seed!
+ unless project.repository_exists?
+ puts
+ puts 'WARNING'
+ puts '======='
+ puts "Seeding #{self.class} is not possible because the given project (#{project.full_path}) doesn't have a repository."
+ puts 'Try specifying a project with working repository or omit the VSA_SEED_PROJECT_ID parameter so the seed script will automatically create one.'
+ puts
+
+ return
+ end
+
create_developers!
create_issues!
@@ -169,6 +180,7 @@ class Gitlab::Seeder::CycleAnalytics
)
project = FactoryBot.create(
:project,
+ :repository,
name: "Value Stream Management Project #{suffix}",
path: "vsmp-#{suffix}",
creator: admin,
diff --git a/db/fixtures/development/33_triage_ops.rb b/db/fixtures/development/33_triage_ops.rb
index 14832ee4af9..f2266e49efc 100644
--- a/db/fixtures/development/33_triage_ops.rb
+++ b/db/fixtures/development/33_triage_ops.rb
@@ -7,7 +7,7 @@ class Gitlab::Seeder::TriageOps
WEBHOOK_URL = 'http://0.0.0.0:$PORT$'
WEBHOOK_TOKEN = "triage-ops-webhook-token"
- WORK_TYPE_LABELS = %w(
+ WORK_TYPE_LABELS = <<~LABELS.split("\n")
bug::availability
bug::mobile
bug::performance
@@ -25,9 +25,9 @@ class Gitlab::Seeder::TriageOps
type::bug
type::feature
type::maintenance
- )
+ LABELS
- WORKFLOW_LABELS = %w(
+ WORKFLOW_LABELS = <<~LABELS.split("\n")
workflow::blocked
workflow::design
workflow::in dev
@@ -41,7 +41,39 @@ class Gitlab::Seeder::TriageOps
workflow::refinement
workflow::validation backlog
workflow::verification
- )
+ LABELS
+
+ OTHER_LABELS = <<~LABELS.split("\n")
+ ep::contributor tooling
+ ep::meta
+ ep::metrics
+ ep::pipeline
+ ep::review-apps
+ ep::triage
+ master-broken::caching
+ master-broken::ci-config
+ master-broken::dependency-upgrade
+ master-broken::flaky-test
+ master-broken::fork-repo-test-gap
+ master-broken::infrastructure
+ master-broken::need-merge-train
+ master-broken::pipeline-skipped-before-merge
+ master-broken::test-selection-gap
+ master-broken::undetermined
+ pipeline:expedite
+ pipeline:expedite-master-fixing
+ pipeline:mr-approved
+ pipeline:run-all-jest
+ pipeline:run-all-rspec
+ pipeline:run-as-if-foss
+ pipeline:run-as-if-jh
+ pipeline:run-flaky-tests
+ pipeline:run-praefect-with-db
+ pipeline:run-review-app
+ pipeline:run-single-db
+ pipeline:skip-undercoverage
+ pipeline:update-cache
+ LABELS
def seed!
puts "Updating settings to allow web hooks to localhost"
@@ -75,6 +107,10 @@ class Gitlab::Seeder::TriageOps
puts "Ensuring workflow type labels"
ensure_labels_for(WORKFLOW_LABELS, 'gitlab-com')
ensure_labels_for(WORKFLOW_LABELS, 'gitlab-org')
+
+ puts "Ensuring other labels"
+ ensure_labels_for(OTHER_LABELS, 'gitlab-com')
+ ensure_labels_for(OTHER_LABELS, 'gitlab-org')
end
end
end
diff --git a/db/fixtures/development/35_emails.rb b/db/fixtures/development/35_emails.rb
new file mode 100644
index 00000000000..a743c326015
--- /dev/null
+++ b/db/fixtures/development/35_emails.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+class Gitlab::Seeder::Emails
+ attr_reader :user, :group_namespace_ids, :project_namespace_ids
+
+ def initialize(user, group_namespace_ids, project_namespace_ids)
+ @user = user
+ @group_namespace_ids = group_namespace_ids.sample(3)
+ @project_namespace_ids = project_namespace_ids.sample(3)
+ end
+
+ def seed!
+ company_email = "#{user.username}-work@example.com"
+ personal_email = "#{user.username}-home@example.com"
+ oss_email = "#{user.username}-oss@example.com"
+ unverified_email = "#{user.username}-unverified@example.com"
+
+ Email.create!(
+ user_id: user.id,
+ email: unverified_email
+ )
+
+ [company_email, personal_email, oss_email].each_with_index do |email, index|
+ email_id = Email.create!(
+ user_id: user.id,
+ email: email,
+ confirmed_at: DateTime.current
+ ).id
+ Users::NamespaceCommitEmail.create!(
+ user_id: user.id,
+ namespace_id: group_namespace_ids[index],
+ email_id: email_id
+ )
+ Users::NamespaceCommitEmail.create!(
+ user_id: user.id,
+ namespace_id: project_namespace_ids[index],
+ email_id: email_id
+ )
+ print '.'
+ end
+ end
+end
+
+Gitlab::Seeder.quiet do
+ puts "\nGenerating email data"
+
+ group_namespace_ids = Group.not_mass_generated.where('parent_id IS NULL').pluck(:id)
+ project_namespace_ids = Project.all.pluck(:project_namespace_id)
+
+ User.first(3).each do |user|
+ Gitlab::Seeder::Emails.new(user, group_namespace_ids, project_namespace_ids).seed!
+ rescue => e
+ warn "\nError seeding e-mails: #{e}"
+ end
+end