GitLab Pipeline Workflow¶
Introduction¶
Overview
Our GitLab pipeline workflow provides a standardized approach to continuous integration and deployment. It supports multiple project types and frameworks through specialized templates while maintaining consistent quality and security standards.
Pipeline Architecture¶
Project Detection and Base Templates
graph TD
subgraph "Project Detection"
A[Repository] --> B{Project Type}
B -->|Single Project| C[Single Config]
B -->|Monorepo| D[Monorepo Config]
end
subgraph "Base Templates"
E[quality.yml]
F[security.yml]
end
C --> E & F
D --> E & F
classDef config fill:#f9f,stroke:#333,stroke-width:2px
classDef template fill:#bbf,stroke:#333,stroke-width:2px
class C,D config
class E,F template
Stack Templates
graph TD
subgraph "Web"
G[Next.js]
H[Nest.js]
end
subgraph "Mobile"
I1[Flutter]
I2[iOS]
I3[Android]
end
subgraph "API"
J1[Node.js]
J2[Python]
end
subgraph "Infrastructure"
K1[Pulumi]
K2[Terraform]
K3[CloudFormation]
end
C -->|Project Match| G & H
C -->|Project Match| I1 & I2 & I3
C -->|Project Match| J1 & J2
C -->|Project Match| K1 & K2 & K3
classDef template fill:#bbf,stroke:#333,stroke-width:2px
class G,H,I1,I2,I3,J1,J2,K1,K2,K3 template
Pipeline Triggers and Stages
graph TD
subgraph "Change Detection"
O{Changes}
end
subgraph "Project Pipelines"
P[Web]
Q[Mobile]
R[API]
T[Infrastructure]
S[Libraries]
end
subgraph "Pipeline Stages"
K[Prepare]
L[Test]
M[Build]
N[Deploy]
end
O -->|/apps/web/*| P
O -->|/apps/mobile/*| Q
O -->|/apps/api/*| R
O -->|/infrastructure/*| T
O -->|/libs/*| S
P & Q & R & T & S --> K --> L --> M --> N
classDef stage fill:#bfb,stroke:#333,stroke-width:2px
class K,L,M,N stage
Template Inheritance
graph TD
subgraph "Base Configuration"
A[.gitlab-ci.yml] --> B[Single Project Config]
A --> C[Monorepo Config]
end
subgraph "Base Templates"
D[quality.yml]
E[security.yml]
end
subgraph "Framework Templates"
F[nextjs.yml]
G[nestjs.yml]
H1[flutter.yml]
H2[ios.yml]
H3[android.yml]
I1[node.yml]
I2[python.yml]
J1[pulumi.yml]
J2[terraform.yml]
J3[cloudformation.yml]
end
B --> D & E
B -->|Project Type Detection| F & G & H1 & H2 & H3 & I1 & I2 & J1 & J2 & J3
C --> D & E
C -->|Path-based Triggers| K[Workspace-specific Pipeline]
K --> F & G & H1 & H2 & H3 & I1 & I2 & J1 & J2 & J3
classDef base fill:#f9f,stroke:#333,stroke-width:2px
classDef template fill:#bbf,stroke:#333,stroke-width:2px
class A,B,C base
class D,E,F,G,H1,H2,H3,I1,I2,J1,J2,J3 template
IaC Pipeline Stages
graph TD
subgraph "IaC Stages"
A[Validate] --> B[Plan]
B --> C[Apply]
C --> D[Destroy]
end
subgraph "Validation Steps"
E1[Lint]
E2[Security Scan]
E3[Cost Estimate]
end
subgraph "Plan Steps"
F1[Preview Changes]
F2[Generate Plan]
F3[Review Changes]
end
subgraph "Apply Steps"
G1[Create/Update]
G2[Wait for Completion]
G3[Verify State]
end
A --> E1 & E2 & E3
B --> F1 --> F2 --> F3
C --> G1 --> G2 --> G3
classDef stage fill:#f9f,stroke:#333,stroke-width:2px
classDef step fill:#bbf,stroke:#333,stroke-width:2px
class A,B,C,D stage
class E1,E2,E3,F1,F2,F3,G1,G2,G3 step
Rules and Triggers
graph TD
subgraph "Trigger Events"
A[Merge Request]
B[Default Branch Push]
C[Tag Creation]
D[Feature Branch Push]
end
subgraph "Pipeline Rules"
E{Single Project}
F{Monorepo}
end
subgraph "Job Execution"
G[Run All Stages]
H[Deploy Stage Skip]
I[Path-based Pipeline]
end
A & B & C & D --> E
A & B & C & D --> F
E -->|MR/Default/Tag| G
E -->|Feature Branch| H
F -->|Path Changes| I
I -->|Workspace Match| G
I -->|No Changes| J[Skip Pipeline]
classDef event fill:#f9f,stroke:#333,stroke-width:2px
classDef rule fill:#bbf,stroke:#333,stroke-width:2px
classDef action fill:#bfb,stroke:#333,stroke-width:2px
class A,B,C,D event
class E,F rule
class G,H,I,J action
Features¶
Project Type Detection
- Automatic detection based on project path and name
- Framework-specific template selection
- Standardized pipeline stages
Base Templates
- Quality checks (linting, testing)
- Security scans (SAST, dependency scanning)
- Reusable across all project types
Framework Templates
- Optimized for specific tech stacks
- Custom build and test configurations
- Framework-specific best practices
Monorepo Support
- Path-based change detection
- Independent pipeline triggers
- Shared cache configuration
- Workspace-specific builds
Pipeline Stages
- Prepare: Setup and validation
- Test: Quality checks and testing
- Build: Compilation and packaging
- Deploy: Environment deployments
Smart Rules
- Event-based execution
- Branch-specific behaviors
- Conditional deployments
- Change-based triggers
Getting Started¶
Setup Steps
- Choose between single project or monorepo configuration
- Follow naming conventions for automatic template selection
- Add minimal pipeline configuration to your project
- Configure required environment variables
Prerequisites
- GitLab Runner with Docker support
- Required access tokens and credentials
- Project follows standard naming conventions
- Appropriate permissions for deployments