Back to topic
Optional
CI gates: what blocks merge
Build a lint/unit/integration/security matrix; decide what is required on PR vs nightly.
- Version
- v1
- Minutes
- ~15
- Evidence
- Self-check in the notebook
Until platform auto-check exists, compare cell output with the expected numbers in the notebook. This is not a debt and does not affect mastery.
Download the notebook and run it locally. Its environment requirements are listed inside.
Notebook contents
Readable on your phone. The code below has not been executed in the browser; download the notebook to run it.
DevOps · Critical path CI / критический путь пайплайна
Activity version: 1 · Seed: n/a · Данные: toy pipeline из заметки CI.
DAG: lint, unit, build стартуют вместе; integration ждёт build; release ждёт все четыре на main.
Длительности (мин): lint 1, unit 4, build 6, integration 5, release 1.
Ожидаемые числа
| Quantity | Value | Tolerance |
|---|---|---|
| critical path | 12 |
exact () |
| serial sum | 17 |
exact |
| lint slack | 10 |
exact |
Самопроверка в ноутбуке
Не влияет на mastery.
import numpy as np
dur = {"lint": 1, "unit": 4, "build": 6, "integration": 5, "release": 1}
deps = {
"lint": [],
"unit": [],
"build": [],
"integration": ["build"],
"release": ["lint", "unit", "build", "integration"],
}
ef = {}
es = {}
for job in ["lint", "unit", "build", "integration", "release"]:
es[job] = max((ef[d] for d in deps[job]), default=0)
ef[job] = es[job] + dur[job]
T = max(ef.values())
serial = int(sum(dur.values()))
lint_slack = es["release"] - ef["lint"]
# Gates on PR vs nightly (matrix check counts).
pr_required = {"lint", "unit", "build", "security"}
nightly_only = {"integration", "e2e"}
assert "integration" in nightly_only
print("T", T, "serial", serial, "lint_slack", lint_slack, "ef", ef)
assert T == 12
assert serial == 17
assert lint_slack == 10
assert ef["build"] == 6 and ef["integration"] == 11 and ef["release"] == 12
print("OK: CI critical path")
Самопроверка в ноутбуке
- (build→integration→release)
- ускорение lint не укорачивает пайплайн