Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Comment the design consideration for the Pipeline/Stage/Task model

天舟b273e57da464
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 21ef807424..163031063e 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -963,19 +963,54 @@ export const ASSIGNEE_APPLICABLE_ACTION_LIST: Map<
//
// Comparison with Tekton
// PIPELINE = Tekton Pipeline
-// STAGE = Tekton Stage
+// STAGE = N/A
// TASK = Tekton Task
+// N/A = Tekton Step
//
// Comparison with GitLab:
// PIPELINE = GitLab Pipeline
// STAGE = GitLab Stage
// TASK = GitLab Job
+// N/A = GitLab Script Step
+//
+// Comparison with GitHub:
+// PIPELINE = GitHub Workflow
+// STAGE = N/A
+// TASK = GitHub Job
+// N/A = GitHub Step
//
// Comparison with Octopus:
// PIPELINE = Octopus Lifecycle
-// STAGE = Octopus Phase
-// TASK = Octopus Task
-
+// STAGE = Octopus Phase + Task
+// TASK = Octopus Step
+//
+//
+// Design consideration
+//
+// - Other mainstream products either have 3 or 4 layers.
+// We choose 3 layers omitting the most granular layer - Step. For now only GitLab has 4 layer systems
+// and its step is mostly used to model a lightweight step like shell script step. This seems like
+// an overkill for our case. BTW, Octopus employes 3 layer design which seems to be sufficient.
+//
+// - All products agree on the smallest querable execution unit (having a dedicated API resource endpoint):
+// Tekton Task/GitLab Job/GitHub Job/Octopus Step.
+// Thus, we also choose Task as our smallest querable execution unit.
+//
+// - We also have a Stage concept which is similar to GitLab Stage/Octopus Phase, in that it's a
+// container to group mulitple tasks. Stage is usually used to model a stage in the development
+// lifecycle (dev, testing, staging, prod).
+//
+// - Only Pipeline and Task have status, while Stage doesn't. Stage's status derives from its
+// containing Tasks.
+//
+// - Pipeline status is 1-to-1 mapping to the Issue status. We introduce Pipepline for decoupling
+// pipeline logic (workflow orchestration etc) from issue logic (collabration etc). And it
+// helps testing (we can mock the entire pipeline implemenation) and also allows Pipeline to
+// be reused in other situation. On the other hand, we want to reduce the complexity of
+// introducing this extra layer, thus we always try to make a fixed 1-to-1 mapping for their
+// respective fields. Client code could combine Pipeline status and its running step status (substatus)
+// to achieve more granular behavior.
+//
// We require a stage to associate with a database. Since database belongs to an instance, which
// in turns belongs to an environment, thus the stage is also associated with an instance and environment.
// The environment has tiers which defines rules like whether requires manual approval.