CI Pipeline Optimization
On this page
Status
-
Create
.adocplan file and link innav.adoc -
Create GitLab issue (#37)
-
Create feature branch
feature/ci-pipeline-optimization -
Implement
.gitlab-ci.ymlchanges (stage consolidation, runner upgrade, auto-trigger) -
Fix E2E DinD networking (compose service name resolution)
-
CI cleanup:
workflow:rules, removerust-build, downsizerust-fmt, updatereview/stop_review -
Update documentation (CHANGELOG.adoc, .claude/docs/testing.md)
-
Commit with
Closes #37, push, open MR -
Verify pipeline timing improvement
Problem
MR pipelines take ~75 minutes wall-clock despite only running lint + unit tests + security scans. Two root causes:
-
Serial stages:
rust-clippy(lint stage, ~35 min) must finish beforerust-test(test stage, ~36 min) can start, even though they have no dependency on each other. -
Undersized runners: Both jobs run on
saas-linux-medium-amd64(4 vCPU). Rust compilation is CPU-bound and parallelizes well — more cores directly reduce compile time. -
No integration/E2E on MR: Integration and E2E tests are
manual+main-only. The sort bug (duplicatesort_byparams) andfindInTableregression both slipped through because no MR pipeline ran them.
Current pipeline timing (pipelines 180-184)
| Job | Runner | Duration | Stage |
|---|---|---|---|
rust-fmt |
medium (4 vCPU) |
~5 min |
lint |
rust-clippy |
medium (4 vCPU) |
~35 min |
lint |
rust-test |
medium (4 vCPU) |
~36 min |
test (blocked by lint) |
security scans (3 jobs) |
default |
~1 min |
test |
review (Antora) |
default |
~30s |
deploy |
Total wall-clock |
~75 min |
Solution
R1: Consolidate stages (clippy + test in parallel)
Replace separate lint and test stages with a single check stage. fmt, clippy, rust-test, and security scans all run in parallel.
stages:
- check # fmt + clippy + test + security scans — all parallel
- build # release binaries + Docker images — main only
- integration # devstack integration tests
- e2e # Playwright browser tests
- deploy # Antora docs
R2: Upgrade runners to large (8 vCPU)
Change .rust-job template from saas-linux-medium-amd64 to saas-linux-large-amd64.
-
clippy: ~35 min → ~18 min (estimated)
-
rust-test: ~36 min → ~20 min (estimated)
-
CI minute cost: 3x multiplier vs 2x (50% more per job, but runs in half the time — net cost similar)
R3: Auto-trigger integration/E2E on MR pipelines
Add MR pipeline rules so integration and E2E tests run automatically when an MR targets main. Keep manual trigger for branch pushes and post-merge main.
# integration-test rules (add before existing main rule):
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"
changes: ["**/*.rs", "**/Cargo.toml", "Cargo.lock"]
# auto on MR — catches regressions before merge
Expected Result
| Metric | Before | After (R1+R2+R3) |
|---|---|---|
MR pipeline wall-clock |
~75 min |
~20-25 min |
clippy + test |
Serial (lint → test) |
Parallel (check) |
Runner size |
medium (4 vCPU) |
large (8 vCPU) |
Integration on MR |
Never |
Auto |
E2E on MR |
Never |
Auto |
Implementation Detail
File: .gitlab-ci.yml
-
Replace
lint+testinstages:list with singlecheck -
Change
rust-fmtstage fromlinttocheck -
Change
rust-clippystage fromlinttocheck -
Change
rust-teststage fromtesttocheck -
Change
sast,secret_detection,dependency_scanningstage overrides fromtesttocheck -
Change
.rust-jobtags fromsaas-linux-medium-amd64tosaas-linux-large-amd64 -
Add MR auto-trigger rule to
integration-test(before existing main rule) -
Add MR auto-trigger rule to
e2e-test(before existing main rule, with additional change paths)
Files Modified
| File | Action |
|---|---|
|
Stage consolidation, runner upgrade, MR auto-trigger rules |
|
Update CI pipeline documentation |
|
Add entry |
|
This plan file |
|
Link plan file |
Verification
-
Push to a feature branch — verify fmt/clippy/test all run in parallel in
checkstage -
Create MR targeting main — verify integration-test and e2e-test auto-trigger
-
Compare pipeline duration to previous runs (~75 min → ~25 min target)
-
Verify main pipeline still works (build/deploy stages unchanged)
GitLab
-
Issue:
chore: CI pipeline optimization — parallel stages, large runners, auto integration/E2E -
Branch:
feature/ci-pipeline-optimization -
Commit message must include
Closes #N