# CI/CD release pipeline diagram, drawn from Python

This page shows engineering teams a release pipeline, from pull request to production, that open-diagram draws from a 34-line Python script. A release pipeline, often called CI/CD, is the set of automatic steps that build, test and ship each code change.


![From pull request to production](https://open-diagram.dev/images/pages/diagrams-ci-cd-release-pipeline-1.svg)

From pull request to production. Drawn by open-diagram 0.6.2 from `examples/pipeline.py`: 0 layout problems. Source: https://github.com/lukendeasy/open-diagram/blob/main/examples/pipeline.py

The picture as text:

```text
From pull request to production
States shown: Live, Being built, In trial, Planned. Solid lines: data flows today.
This quarter: 1. Cache every build (Build); 2. Scan every image (Checks); 3. Release to 5% first (Release).

Blocks, left to right:
- Code: Pull request; Code review. Owner: Every team
- Build [step 1]: Compile; Unit tests; Container image; Build cache (being built). Owner: Build team
- Checks [step 2]: Integration tests; Security scan (being built); Load test (planned). Owner: Quality team
- Release [step 3]: Staging; Canary, 5% of users (in trial); Production. Owner: Platform team
Lines:
- Code -> Build
- Build -> Checks
- Checks -> Release
- Release -> Code, labeled "If errors rise: roll back and tell the author"
```


## What does this pipeline diagram show?

Four stages run left to right, each with the team that owns it. The line along the bottom is the way back when errors rise.

The key numbers three changes for this quarter. Two are being built. The third, a canary release that sends a new version to 5% of users first, is in trial.

## Which building blocks draw it?


```python
"""A release pipeline, from pull request to production, with a rollback lane underneath.
Run: python3 examples/pipeline.py"""
import os

from open_diagram import Diagram, Panel, Tile, Tiles

HERE = os.path.dirname(os.path.abspath(__file__))

STEPS = [(1, "Cache every build"), (2, "Scan every image"), (3, "Release to 5% first")]


def build() -> Diagram:
    d = Diagram("From pull request to production", tag="EXAMPLE", steps=STEPS, steps_label="This quarter")
    (code,), (build_,), (checks,), (release,) = d.columns([
        [Panel("Code", Tiles(["Pull request", "Code review"], cols=1), footer="Owner: Every team")],
        [Panel("Build", Tiles(["Compile", "Unit tests", "Container image", Tile("Build cache", status="building")],
                              cols=1), step=1, footer="Owner: Build team")],
        [Panel("Checks", Tiles(["Integration tests", Tile("Security scan", status="building"),
                                Tile("Load test", status="planned")], cols=1), step=2,
               footer="Owner: Quality team")],
        [Panel("Release", Tiles(["Staging", Tile("Canary, 5% of users", status="trial"), "Production"], cols=1),
               step=3, footer="Owner: Platform team")],
    ], gap=72, valign="center")
    d.link(code, build_)
    d.link(build_, checks)
    d.link(checks, release)
    bottom = max(p.bottom for p in d.placed) + 44
    d.link(release, code, start="bottom", end="bottom", via_y=bottom,
           label="If errors rise: roll back and tell the author")
    return d


if __name__ == "__main__":
    build().save(os.path.join(HERE, "..", "docs", "images", "pipeline"))
```


- `d.columns()` places one panel per stage. `valign="center"` centres each against the tallest.
- `Tiles([...], cols=1)` stacks each stage's tiles in one column.
- `Tile("Load test", status="planned")` marks one tile.
- `steps=` and `steps_label="This quarter"` on the `Diagram`, with `step=` on three panels, number the changes.
- The rollback line uses `via_y`, 44 px below the lowest panel, so it runs in a lane that crosses no stage.

## Can the diagram be checked on every push?

Yes. Keep the file next to the code and add open-diagram's GitHub Action to the workflow. On every push it checks or redraws the diagrams, and fails if a layout problem appears. It takes JSON and Mermaid files, and Python files with a `build()` function.

## Can I write it in JSON?

Yes, and it is shorter. `"lane": "bottom"` takes the place of `via_y`:


```json
{
  "title": "From pull request to production",
  "columns": [
    [{"id": "code", "title": "Code", "tiles": ["Pull request", "Code review"], "cols": 1}],
    [{"id": "build", "title": "Build", "tiles": ["Compile", "Unit tests", {"label": "Build cache", "status": "building"}], "cols": 1}],
    [{"id": "checks", "title": "Checks", "tiles": ["Integration tests", {"label": "Load test", "status": "planned"}], "cols": 1}],
    [{"id": "release", "title": "Release", "tiles": ["Staging", {"label": "Canary, 5% of users", "status": "trial"}, "Production"], "cols": 1}]
  ],
  "gap": 72,
  "links": [
    {"from": "code", "to": "build"},
    {"from": "build", "to": "checks"},
    {"from": "checks", "to": "release"},
    {"from": "release", "to": "code", "lane": "bottom", "label": "If errors rise: roll back"}
  ]
}

```

![From pull request to production](https://open-diagram.dev/images/pages/diagrams-ci-cd-release-pipeline-3.svg)

The check: 0 layout problems


## How do I make my own?

After `pip install open-diagram`, copy `examples/pipeline.py`, or the JSON above, into your repository and rename the stages and tiles. Run `open-diagram check pipeline.py`, then `open-diagram draw pipeline.py`. When a change ships, delete its tile's `status`, or keep statuses in a separate file and draw with `--statuses`.

Updated November 25, 2026. Web page: https://open-diagram.dev/diagrams/ci-cd-release-pipeline.html

See also:

- [Keep architecture diagrams current with a GitHub Action](https://open-diagram.dev/guides/keep-diagrams-current.md)
- [Card payment flow diagram, drawn from Python](https://open-diagram.dev/diagrams/card-payment-flow.md)
- [Draw diagrams without Python: write JSON from any language](https://open-diagram.dev/guides/json-from-any-language.md)
