From 5088dd48f3313a46df05a79ad4ffd1c07c7b2f93 Mon Sep 17 00:00:00 2001
From: Felipe Artur <fcardozo@gitlab.com>
Date: Wed, 30 Aug 2023 13:33:32 +0000
Subject: [PATCH] Relate seed files to features in documentation

---
 doc/development/development_seed_files.md | 26 +++++++++++++++++
 doc/development/value_stream_analytics.md | 34 +----------------------
 2 files changed, 27 insertions(+), 33 deletions(-)
 create mode 100644 doc/development/development_seed_files.md

diff --git a/doc/development/development_seed_files.md b/doc/development/development_seed_files.md
new file mode 100644
index 0000000000000..2bf3688fd489d
--- /dev/null
+++ b/doc/development/development_seed_files.md
@@ -0,0 +1,26 @@
+---
+stage: none
+group: unassigned
+info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
+---
+
+# Development seed files
+
+Development seed files are listed under `gitlab/db/fixtures/development/` and `gitlab/ee/db/fixtures/development/`
+folders. These files are used to populate the database with records to help verifying if feature functionalities, like charts, are working as expected on local host.
+
+The task `rake db:seed_fu` can be used to run all development seeds with the exception of the ones under a flag which is usually passed as an environment variable.
+
+The following table summarizes the seeds and tasks that can be used to generate
+data for features.
+
+| Feature                                                                                                           | Command                                                                                                           | Seed                                                                                                                                                |
+|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
+| DevOps Adoption                                                                                                   | `FILTER=devops_adoption bundle exec rake db:seed_fu`                                                          | [31_devops_adoption.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/db/fixtures/development/31_devops_adoption.rb)                        |
+| Value Streams Dashboard                                                                                           | `FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu`                                               | [17_cycle_analytics.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/fixtures/development/17_cycle_analytics.rb)                           |
+| Value Stream Analytics                                                                                            | `FILTER=customizable_cycle_analytics SEED_CUSTOMIZABLE_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu` | [30_customizable_cycle_analytics](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/db/fixtures/development/30_customizable_cycle_analytics.rb) |
+| CI/CD analytics                                                                                                   | `FILTER=ci_cd_analytics SEED_CI_CD_ANALYTICS=1 bundle exec rake db:seed_fu`                                   | [38_ci_cd_analytics](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/fixtures/development/38_ci_cd_analytics.rb?ref_type=heads)               |
+| Contributions Analytics<br><br>Productivity Analytics<br><br>Code review Analytics<br><br>Merge Request Analytics | `FILTER=productivity_analytics SEED_PRODUCTIVITY_ANALYTICS=1 bundle exec rake db:seed_fu`             | [90_productivity_analytics](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/db/fixtures/development/90_productivity_analytics.rb)             |
+| Repository Analytics                                                                                              | `FILTER=14_pipelines NEW_PROJECT=1 bundle exec rake db:seed_fu`                                       | [14_pipelines](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/fixtures/development/14_pipelines.rb?ref_type=heads)                           |
+| Issue Analytics<br><br>Insights                                                                                   | `NEW_PROJECT=1 bin/rake gitlab:seed:insights:issues`                                                          | [insights Rake task](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/seed/insights.rake)                                     |
+| DORA metrics                                                                                                      | `SEED_DORA=1 FILTER=dora_metrics bundle exec rake db:seed_fu`                                                 | [92_dora_metrics](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/db/fixtures/development/92_dora_metrics.rb)                                 |
diff --git a/doc/development/value_stream_analytics.md b/doc/development/value_stream_analytics.md
index 8bb4b989011d8..5aa6aecd9db7f 100644
--- a/doc/development/value_stream_analytics.md
+++ b/doc/development/value_stream_analytics.md
@@ -354,36 +354,4 @@ Analytics::CycleAnalytics::ReaggregationWorker.new.perform
 
 #### Value stream analytics
 
-Seed issues and merge requests for value stream analytics:
-
-  ```shell
-  // Seed 10 issues for the project specified by <project-id>
-  $ VSA_SEED_PROJECT_ID=<project-id> VSA_ISSUE_COUNT=10 SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
-  ```
-
-#### DORA metrics
-
-Seed DORA daily metrics for value stream, insights and CI/CD analytics:
-
-1. On the left sidebar, select **Search or go to** and find your project.
-1. On the project's homepage, in the upper-left corner, copy the **Project ID**. You need it in a later step.
-1. [Create an environment for your selected project from the UI](../ci/environments/index.md#create-a-static-environment) named `production`.
-1. Open the rails console:
-
-   ```shell
-   rails c
-   ```
-
-1. In the rails console, find the created environment by searching for the project ID:
-
-    ```shell
-    e = Environment.find_by(project_id: <project-id>, name: "production")
-    ```
-
-1. To seed data for the past 100 days for the environment, run the following command:
-
-    ```shell
-    100.times { |i| Dora::DailyMetrics.create(environment_id: e.id, date: (i + 1).days.ago, deployment_frequency: rand(50), incidents_count: rand(5),   lead_time_for_changes_in_seconds: rand(50000), time_to_restore_service_in_seconds: rand(100000)) }
-    ```
-
-DORA metric data should now be available for your selected project and any group or subgroup it belongs to.
+For instructions on how to seed data for value stream analytics, see [development seed files](../development/development_seed_files.md).
-- 
GitLab