Pipeline design patterns
Encyclopedia home · Search machine-readable catalog
The patterns describe the decision and evidence around a pipeline. Use the linked executable snippets to implement the design on your platform.
Execution and optimization
P01
Sequential pipeline
Flow Lint → test → package.
When to use it. A small codebase needs ordered checks with simple failure isolation.
Trade-off. One job can share its checkout, but long independent steps extend the critical path.
Prove it. Time each step and inject a failing lint assertion to prove packaging is skipped.
Implement with CICD-025 · CICD-086
P02
Fork and join
Flow Lint and tests start independently → aggregate gate → publish.
When to use it. Independent verifications share a source commit and must all succeed.
Trade-off. Split jobs use isolated filesystems and some may queue if runner capacity is low.
Prove it. Fail one limb and verify the stable named check fails without starting publish.
flowchart TD A[Commit] --> B[Lint] A --> C[Tests] B --> D[Required gate] C --> D D --> E[Publish]
Implement with CICD-018 · CICD-491
P03
Directed acyclic graph
Flow Build API → API integration, build worker → worker integration, both integrations → release.
When to use it. Components have partial dependencies and can start as soon as their upstream artifact exists.
Trade-off. Incorrect edges introduce races or unnecessary serialization.
Prove it. Inspect the DAG and start times, then fail one required upstream.
flowchart TD A[Build API] --> C[API integration] B[Build worker] --> D[Worker integration] C --> E[Release gate] D --> E
Implement with CICD-017 · CICD-222
P04
Conditional branch
Flow Change detector → API checks and/or worker checks → always-report gate.
When to use it. Monorepo changes affect a subset of components.
Trade-off. Base-ref errors and shared files can silently omit required checks.
Prove it. Compare isolated service, shared module and docs-only commits against the expected check set.
Affected-only testing variant. Merge-base diff → reverse dependency closure → execute tests. Many services share packages but most PRs are scoped. Removed files, renames and shared lock files can break selection logic. Maintain a golden fixture set mapping diffs to expected impacted packages.
Implement with CICD-221 · CICD-381 · CICD-385
P05
Dynamic matrix
Flow Planner → typed JSON matrix → selected jobs → collector.
When to use it. Test targets vary with the commit, architecture or feature set.
Trade-off. Invalid JSON and unbounded input can block the workflow or flood runners.
Prove it. Test an empty set, a valid set and a set larger than the concurrency cap.
Implement with CICD-219 · CICD-220
P06
Deterministic sharding
Flow Test manifest → stable partition function → shards → report merge.
When to use it. One test suite exceeds the size or duration of a single runner job.
Trade-off. Uneven shards and incompatible fixtures can hide cases or serialize internally.
Prove it. Compare union and intersection of test IDs and measure time of the slowest shard.
Implement with CICD-043 · CICD-045
P07
Incremental builds
Flow Dependency graph and hashes → build affected targets → validate outputs.
When to use it. Workspace has declared inputs and reproducible build outputs.
Trade-off. Hidden environment inputs create stale results.
Prove it. Change a shared dependency and compare incremental output against a clean build.
Implement with CICD-383 · CICD-393
P08
Distributed caching
Flow Key from source and toolchain → cache → verified consumer.
When to use it. Repeated deterministic actions run on interchangeable workers.
Trade-off. Cache poisoning or weak keys affect future trusted jobs.
Prove it. Compare cold and warm duration and force a cache miss by changing an input.
Implement with CICD-384 · CICD-389
Release and deployment
P09
Build once, promote everywhere
Flow Build → sign digest → staging validation → production promotion.
When to use it. Environment paths differ but should test and promote exactly the same artifact.
Trade-off. Mutable tags or rebuilding independently make evidence non-transferable.
Prove it. Compare approved digest, deployed digest and provenance across environments.
Immutable releases variant. Candidate content address → protected manifest → retain known-good digest. Rollbacks and auditability need stable identity. Dependency metadata and retained blobs must survive garbage collection. Attempt to replace a tag and verify deployment policy uses original digest.
Implement with CICD-098 · CICD-305 · CICD-377 · CICD-127
P10
Release train
Flow Collect approved changes → cutoff → candidate qualification → batch promotion.
When to use it. Teams need predictable integrated release windows.
Trade-off. One late unvalidated change delays the train or requires deferral.
Prove it. Track included SHAs, rollback plan and the cutoff applied to the batch.
Implement with CICD-130 · CICD-493
P11
Tag-based releases
Flow Commit accepted → protected tag verified → build and attach artifacts.
When to use it. Release intent is expressed through consistent versioned tags.
Trade-off. Tag creation permissions and concurrent duplicate runs must be checked.
Prove it. Send a tag targeting an unapproved SHA and confirm no release artifacts publish.
Implement with CICD-008 · CICD-173
P12
Rolling deployment
Flow Begin with old replicas → schedule ready replacements → retire old replicas.
When to use it. Stateless workloads can coexist across old and new revisions.
Trade-off. Resource pressure or incompatible shared schemas can stall replacement.
Prove it. Track available replicas and external error rate throughout rollout.
Implement with CICD-137 · CICD-164
P13
Blue-green deployment
Flow Standby deployment → preview health → switch traffic → retain previous route.
When to use it. Fast traffic switching matters and double capacity is acceptable.
Trade-off. Both environments share data and may drift, making traffic reversal risky.
Prove it. Prove old/new schema compatibility and measure route restoration.
Implement with CICD-302 · CICD-320
P14
Canary deployment
Flow Split traffic → compare canary/control → increase exposure or abort.
When to use it. A candidate must demonstrate health with real or representative traffic.
Trade-off. Low volume, noisy metrics and unrepresentative traffic can produce false approval.
Prove it. Verify minimum observations and exercise a failing metric threshold.
flowchart TD
A[Candidate] --> B[Small traffic share]
B --> C{Metric gate}
C -- Pass --> D[Increase exposure]
C -- Fail --> E[Abort candidate]
Implement with CICD-301 · CICD-303 · CICD-304
P15
Shadow traffic
Flow Production request → primary response, isolated copy → candidate comparison.
When to use it. Compare outputs and latency without changing what callers receive.
Trade-off. Duplicate writes and production data export can cause material harm.
Prove it. Disable mutation on the candidate, use approved traffic and compare paired samples.
Implement with CICD-324 · CICD-357 · CICD-437
P16
Feature flags
Flow Deploy inactive branch → enable for sample cohort → measure → expand or disable.
When to use it. App activation must be independent of artifact delivery.
Trade-off. Stale flags and defaults make behavior hard to audit and test.
Prove it. Test both values and record config version in deployment evidence.
Implement with CICD-358 · CICD-495
Reliability and security
P17
Bounded read retry
Flow Read → transient failure → wait with jitter → retry until deadline.
When to use it. A read-only check encounters intermittent network or dependency errors.
Trade-off. Unbounded attempts can exhaust job budget or overload unhealthy services.
Prove it. Inject transient and permanent failures and measure total elapsed time.
Implement with CICD-229 · CICD-343
P18
Compensating action
Flow Apply reversible change A → change B fails → undo A → report failure.
When to use it. Workflow spans resources with no shared transaction.
Trade-off. Compensation may fail or be unsafe when ownership has changed.
Prove it. Fail B deliberately and verify A is rolled back only for this run's resource ID.
flowchart TD
A[Apply first change] --> B{Second change succeeds}
B -- Yes --> C[Record completion]
B -- No --> D[Compensate first change]
D --> E[Record failure]
Implement with CICD-342 · CICD-365
P19
Verified rollback
Flow Failed candidate → select known-good artifact → restore desired state → verify.
When to use it. Fast recovery requires known-good evidence and data compatibility.
Trade-off. Old application may fail after an irreversible schema contraction.
Prove it. Rehearse response time, app metrics and exact restored digest.
Implement with CICD-304 · CICD-320 · CICD-440
P20
Circuit breaker
Flow Closed → repeated failures → open → timed probe → closed or reopen.
When to use it. A downstream dependency may become persistently unhealthy.
Trade-off. Balancing test timing and half-open concurrency is critical.
Prove it. Fake time and verify no requests except bounded probes while open.
Implement with CICD-344 · CICD-345
P21
Zero-trust delivery
Flow Untrusted verification → immutable evidence → separately authorized deploy.
When to use it. Build input, runners, artifacts and credentials have different trust boundaries.
Trade-off. A downstream privileged job must verify provenance and avoid blindly trusting upstream filenames.
Prove it. Run fork validation with no secrets and reject mismatched evidence.
Policy as gate variant. Render proposed config → evaluate versioned policy → record evidence → allow apply. Infrastructure checks need central rules with explicit exceptions. Wrong input scope and failing open on missing data weaken enforcement. Run known-good and known-bad fixtures and retain the policy version.
Implement with CICD-375 · CICD-376 · CICD-377 · CICD-244 · CICD-368 · CICD-379
P22
Signed artifacts
Flow Build artifact → sign/attest identity → verify signer plus digest at deploy.
When to use it. Consumers must establish provenance independently of distribution.
Trade-off. A signature without signer policy or artifact binding is insufficient.
Prove it. Modify one byte and test an unexpected signer. Both must be rejected.
Implement with CICD-376 · CICD-377
Infrastructure and platform
P23
GitOps reconciliation
Flow Review Git change → controller applies revision → health/sync verification.
When to use it. The versioned repository declares intended state for environments.
Trade-off. Implicit deletions and emergency manual drift require independent procedures.
Prove it. Change a disposable resource and observe correction or deliberate drift signal.
Implement with CICD-293 · CICD-295 · CICD-298
P24
Plan and apply
Flow Validate → generate reviewed plan → approval → exact apply.
When to use it. Declarative infrastructure changes need change-set review and state ownership.
Trade-off. State changes can invalidate the reviewed plan and plan files can reveal credentials.
Prove it. Verify plan hash and reject stale state before writes.
Implement with CICD-235 · CICD-237 · CICD-239
P25
Ephemeral environments
Flow Create per-PR namespace → deploy candidate → check → clean on close or TTL.
When to use it. Reviewers need isolated temporary service copies.
Trade-off. Shared databases, dangling DNS and privileges from untrusted PRs are risks.
Prove it. Test teardown after failed deployment and verify budget and ownership tags.
flowchart TD A[Pull request] --> B[Isolated preview] B --> C[Health gate] B --> D[Closed event] B --> E[Expiry sweep] D --> F[Owned resource cleanup] E --> F
Implement with CICD-276 · CICD-396 · CICD-404
P26
Platform golden path
Flow Trusted template → repo onboarding → required baseline checks → catalog registration.
When to use it. Product teams need a repeatable service delivery default.
Trade-off. A template can drift from its upgrades or become an inflexible gate.
Prove it. Scaffold a disposable service and measure time-to-first-green run.
Centralized workflow templates variant. Versioned provider → restricted caller inputs → compatibility check → pin updates. Multiple repositories need consistent validation and release controls. Retroactive changes or broad secret forwarding expand blast radius. Test caller contracts against current and previous provider versions.
Implement with CICD-411 · CICD-416 · CICD-417 · CICD-104 · CICD-421
P27
Self-service provisioning
Flow Request schema → policy and approval → plan → scoped controller applies → report.
When to use it. Platform users need a governed way to provision standard resources.
Trade-off. Ownership, quota and rollback must survive a partial or retried request.
Prove it. Replay the same request ID and prove no duplicate resources are created.
Implement with CICD-418 · CICD-419 · CICD-420
AI and inference
P28
Model promotion
Flow Pin artifact revision → schema and eval → approval → immutable runtime reference.
When to use it. Model artifacts, tokenizer and runtime data contracts must travel together.
Trade-off. Incompatible embedding vectors or silent model substitutions can degrade results.
Prove it. Use an immutable manifest and mismatch fixture for model and tokenizer revisions.
Implement with CICD-427 · CICD-434 · CICD-439
P29
Benchmark-gated model release
Flow Baseline/candidate fixed load → quality, latency and cost gates → promote digest.
When to use it. Runtime quality under load is a release requirement.
Trade-off. GPU temperature, sampling mix and concurrency distort comparisons.
Prove it. Repeat runs, report completion counts, TTFT, ITL and throughput, and compare operating cost.
Implement with CICD-450 · CICD-455 · CICD-470
P30
GPU-aware scheduling
Flow Approved runner label → device probe → engine checks → release benchmarks.
When to use it. Workloads need a particular CUDA/VRAM/hardware combination.
Trade-off. Labels can drift and scheduling capacity may be scarce.
Prove it. Record hardware, driver, CUDA and peak memory from inside the candidate job.