Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Add the Pipeline model.
天舟4ef70a4c22e2
diff --git a/frontend/src/miragejs/factories/index.js b/frontend/src/miragejs/factories/index.jsindex a89f94ad73..5de28e31c3 100644--- a/frontend/src/miragejs/factories/index.js+++ b/frontend/src/miragejs/factories/index.js@@ -7,6 +7,7 @@ import dataSource from "./dataSource";import dataSourceMember from "./dataSourceMember";import database from "./database";import issue from "./issue";+import pipeline from "./pipeline";import task from "./task";import step from "./step";import activity from "./activity";@@ -35,6 +36,7 @@ export default {...database,...message,...issue,+ ...pipeline,...task,...step,...activity,diff --git a/frontend/src/miragejs/factories/pipeline.js b/frontend/src/miragejs/factories/pipeline.jsnew file mode 100644index 0000000000..d554edf2d7--- /dev/null+++ b/frontend/src/miragejs/factories/pipeline.js@@ -0,0 +1,26 @@+import { Factory } from "miragejs";+import faker from "faker";+import { UNKNOWN_ID } from "../../types";++export default {+ pipeline: Factory.extend({+ name(i) {+ return faker.fake("{{lorem.sentence}}");+ },+ creatorId() {+ return UNKNOWN_ID;+ },+ createdTs(i) {+ return Date.now() - (i + 1) * 1800 * 1000;+ },+ updaterId() {+ return UNKNOWN_ID;+ },+ updatedTs(i) {+ return Date.now() - i * 3600 * 1000;+ },+ status() {+ return "PENDING";+ },+ }),+};diff --git a/frontend/src/miragejs/models/index.js b/frontend/src/miragejs/models/index.jsindex f9671314eb..3b426314e3 100644--- a/frontend/src/miragejs/models/index.js+++ b/frontend/src/miragejs/models/index.js@@ -26,6 +26,7 @@ export default {project: hasMany(),projectMember: hasMany(),issue: hasMany(),+ pipeline: hasMany(),task: hasMany(),step: hasMany(),environment: hasMany(),@@ -89,6 +90,15 @@ export default {issuePatch: Model,issueStatusPatch: Model,+ // Pipeline+ pipeline: Model.extend({+ workspace: belongsTo(),+ task: hasMany(),+ step: hasMany(),+ }),+ taskPatch: Model,+ taskStatusPatch: Model,+// Tasktask: Model.extend({workspace: belongsTo(),diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.tsindex e9997b785e..74d6639daf 100644--- a/frontend/src/types/bytebase.ts+++ b/frontend/src/types/bytebase.ts@@ -318,6 +318,8 @@ export type ProjectId = string;export type IssueId = string;+export type PipelineId = string;+export type TaskId = string;export type StepId = string;@@ -559,49 +561,6 @@ export type ProjectPatch = {key?: string;};-// Issue, Task, Step are the backbones of execution.-//-// A ISSUE consists of multiple TASKS. A TASK consists of multiple STEPS.-//-// Comparison with Tekton-// ISSUE = Tekton Pipeline-// TASK = Tekton Task-// STEP = Tekton Step-//-// Comparison with GitLab:-// ISSUE = GitLab Pipeline-// TASK = GitLab Task-// STEP = GitLab Job-//-// Comparison with Octopus:-// ISSUE = Octopus Lifecycle-// TASK = Octopus Phase-// STEP = Octopus Step--// We require a task to associate with a database. Since database belongs to an instance, which-// in turns belongs to an environment, thus the task is also associated with an instance and environment.-// The environment has tiers which defines rules like whether requires manual approval.--/*- An example-- An alter schema ISSUE- Dev TASK (db_dev, env_dev)- Change dev database schema-- Testing TASK (db_test, env_test)- Change testing database schema- Verify integration test pass-- Staging TASK (db_staging, env_staging)- Approve change- Change staging database schema-- Prod TASK (db_prod, env_prod)- Approve change- Change prod database schema-*/-// Issuetype IssueTypeGeneral = "bytebase.general";@@ -756,6 +715,93 @@ export const ASSIGNEE_APPLICABLE_ACTION_LIST: Map<["CANCELED", ["REOPEN"]],]);+// Pipeline, Task, Step are the backbones of execution.+//+// A PIPELINE consists of multiple TASKS. A TASK consists of multiple STEPS.+//+// Comparison with Tekton+// PIPELINE = Tekton Pipeline+// TASK = Tekton Task+// STEP = Tekton Step+//+// Comparison with GitLab:+// PIPELINE = GitLab Pipeline+// TASK = GitLab Task+// STEP = GitLab Job+//+// Comparison with Octopus:+// PIPELINE = Octopus Lifecycle+// TASK = Octopus Phase+// STEP = Octopus Step++// We require a task to associate with a database. Since database belongs to an instance, which+// in turns belongs to an environment, thus the task is also associated with an instance and environment.+// The environment has tiers which defines rules like whether requires manual approval.++/*+ An example++ An alter schema PIPELINE+ Dev TASK (db_dev, env_dev)+ Change dev database schema++ Testing TASK (db_test, env_test)+ Change testing database schema+ Verify integration test pass++ Staging TASK (db_staging, env_staging)+ Approve change+ Change staging database schema++ Prod TASK (db_prod, env_prod)+ Approve change+ Change prod database schema+*/+// Pipeline+export type PipelineStatus =+ | "PENDING"+ | "RUNNING"+ | "DONE"+ | "FAILED"+ | "CANCELED";++export type Pipeline = {+ id: PipelineId;++ // Related fields+ taskList: Task[];++ // Standard fields+ creator: Principal;+ createdTs: number;+ updater: Principal;+ updatedTs: number;++ // Domain specific fields+ name: string;+ status: PipelineStatus;+};++export type PipelineNew = {+ // Related fields+ taskList: TaskNew[];++ // Standard fields+ creatorId: PrincipalId;++ // Domain specific fields+ name: string;+};++export type PipelineStatusPatch = {+ // Standard fields+ updaterId: PrincipalId;++ // Domain specific fields+ status: PipelineStatus;+ comment?: string;+};+// Taskexport type TaskType =| "bytebase.task.unknown"