What problem does it solve?
BK-CI's Pipeline Model architecture defines the core data structure used across the platform, enabling consistent representation, versioning, and serialization of pipelines from design to execution.
Core Features & Use Cases
- Four-layer nested model: Model -> Stage[] -> Container[] -> Element[] that capture the entire pipeline hierarchy.
- Serialization and versioning: JSON-based persistence with per-version model snapshots for history and rollback.
- Validation and compatibility: transformCompatibility routines to migrate legacy fields and maintain backward compatibility.
- Cross-system integration: a single canonical model used by frontend, backend, and execution engines.
- Extensibility: supports templates and descriptors to compose reusable pipeline patterns.
Quick Start
Inspect the core model classes under src/backend/ci/core/common/common-pipeline to understand the Model, Stage, Container, and Element definitions. Create a minimal model with Model.defaultModel(pipelineName, userId) and progressively add stages/containers/elements; persist and load versions via T_PIPELINE_RESOURCE_VERSION; merge with runtime data from T_PIPELINE_BUILD_RECORD_MODEL when resuming runs.