[V2] => Create a developer friendly version of the Seeding harness to provide scalability and improve availability
Problem to Solve
V1 of the seeding harness - the Seeds are represented as Ruby files.
# some_seed.rb
# create a group, project and issue.
create(:group, name: 'My Group', ...).tap do |group|
create(:project, :public, name: 'My Project', namespace: group).tap do |project|
create(:issue, title: 'My Issue', project: project, weight: 5)
end
end
This, while it does work - this requires:
- A more technical hands-on approach
- Knowledge of FactoryBot
- Knowledge of GitLab and its models, and what the Factories are named
- Knowledge of what attributes to able to be passed into FactoryBot
Proposal
-
Drive further adoption, provide scalability and improve availability by creating a YAML harness that will allow Seed files to be represented as YAML files. -
In addition, provide documentation and a quick-start/how-to guide that provides instructions of common records to seed. (This will be an ongoing list tracked in #361988 (closed)) - How to create Group Labels
- How to create a Milestone
-
How to create a ProjectPublicPrivate
How to create a Group-
How to create an IssueConfidentialNon-confidentialWith / Without Weights
Example
Instead of this Ruby seed file:
# create a group, project and issue.
create(:group, name: 'My Group', ...).tap do |group|
create(:project, :public, name: 'My Project', namespace: group).tap do |project|
create(:issue, title: 'My Issue', project: project, weight: 5)
end
end
It will look like this Yaml file:
---
# AwesomeCo Seed File
name: AwesomeCo
labels:
# Priority
- name: priority_1
group_id: <%= @namespace.id %>
color: "#FF0000"
traits:
- on_group
- name: priority_2
group_id: <%= @namespace.id %>
color: "#DD0000"
traits:
- on_group
- name: priority_3
group_id: <%= @namespace.id %>
color: "#CC0000"
traits:
- on_group
- name: priority_4
group_id: <%= @namespace.id %>
color: "#BB0000"
traits:
- on_group
# Squad Labels
- name: squad_A
group_id: <%= @namespace.id %>
title: "squad::a"
color: "#CCCCCC"
- name: squad_B
group_id: <%= @namespace.id %>
title: "squad::b"
color: "#CCCCCC"
- name: squad_C
group_id: <%= @namespace.id %>
title: "squad::c"
color: "#CCCCCC"
- name: squad_D
group_id: <%= @namespace.id %>
title: "squad::d"
color: "#CCCCCC"
- name: squad_E
group_id: <%= @namespace.id %>
title: "squad::e"
color: "#CCCCCC"
- name: squad_F
group_id: <%= @namespace.id %>
title: "squad::f"
color: "#CCCCCC"
milestones:
# Past Release
- title: "Release #1"
group_id: <%= @namespace.id %>
start_date: <%= 1.month.ago %>
due_date: <%= 1.day.ago %>
traits:
- on_group
# Current Ongoing Release
- title: "Release #2"
group_id: <%= @namespace.id %>
start_date: <%= 1.day.ago %>
due_date: <%= 1.month.from_now %>
traits:
- on_group
# Past Release
- title: "Release #3"
group_id: <%= @namespace.id %>
start_date: <%= 1.month.ago %>
due_date: <%= 1.day.ago %>
traits:
- on_group
# Future Release
- title: "Release #4"
group_id: <%= @namespace.id %>
start_date: <%= 1.month.from_now %>
due_date: <%= 2.months.from_now %>
traits:
- on_group
epics:
- title: "v1.0 Launch [XL]"
description: |
# MVC
A user can create an account, login and modify their settings
# Stand up infra
- [ ] Standup infra `10`
- [x] Task
- [ ] Key Result
- [ ] Task 2
- [ ] Task 3
# groups:
# - name: Logistics
# parent: <%= @namespace %>
# projects:
# - name: My Project
# - name: My Other Project
# project_labels:
# - title: Project Label
# color: '#FFFF00'
# project: <%= projects[0] %>
# issues:
# - title: Adjust Text on Homepage to reflect new brand messaging
# project: <%= projects[0] %>
# milestone: <%= milestones[1] %>
Edited by Dan Davison