{
  "schemaVersion": "0.1",
  "diagramFamily": "flowchart",
  "scene": {
    "id": "deploy-pipeline-from-github-actions",
    "title": "orders-api deploy pipeline",
    "brief": "How a push to main reaches production for orders-api, drawn from .github/workflows/deploy.yml.\nIn run order, top to bottom: a process box for each job or step that does something, a decision for each check with labeled yes and no exits, pills for the trigger and the outcomes. Keep element IDs; change it with edits when the workflow changes, and name the pull request in the edit's message."
  },
  "elements": [
    { "id": "push", "kind": "node", "nodeType": "generic", "shape": "pill", "label": "Push to main" },
    { "id": "build", "kind": "node", "nodeType": "process", "label": "Build image" },
    { "id": "test", "kind": "node", "nodeType": "process", "label": "Run tests" },
    { "id": "testsOk", "kind": "node", "nodeType": "decision", "label": "Tests pass?" },
    { "id": "staging", "kind": "node", "nodeType": "process", "label": "Deploy to staging" },
    { "id": "smoke", "kind": "node", "nodeType": "decision", "label": "Smoke tests pass?" },
    { "id": "shift", "kind": "node", "nodeType": "process", "label": "Shift 10% more traffic" },
    { "id": "errOk", "kind": "node", "nodeType": "decision", "label": "Error rate OK?" },
    { "id": "full", "kind": "node", "nodeType": "decision", "label": "At 100%?" },
    { "id": "done", "kind": "node", "nodeType": "generic", "shape": "pill", "label": "Deployed" },
    { "id": "rollback", "kind": "node", "nodeType": "process", "label": "Roll back" },
    { "id": "notify", "kind": "node", "nodeType": "process", "label": "Notify on-call" },
    { "id": "failed", "kind": "node", "nodeType": "generic", "shape": "pill", "label": "Release failed" },
    { "id": "fix", "kind": "node", "nodeType": "process", "label": "Open fix PR" },

    { "id": "e1", "kind": "edge", "from": { "elementId": "push" }, "to": { "elementId": "build" } },
    { "id": "e2", "kind": "edge", "from": { "elementId": "build" }, "to": { "elementId": "test" } },
    { "id": "e3", "kind": "edge", "from": { "elementId": "test" }, "to": { "elementId": "testsOk" } },
    { "id": "e4", "kind": "edge", "from": { "elementId": "testsOk" }, "to": { "elementId": "staging" }, "label": "yes" },
    { "id": "e5", "kind": "edge", "from": { "elementId": "testsOk" }, "to": { "elementId": "fix" }, "label": "no" },
    { "id": "e6", "kind": "edge", "from": { "elementId": "staging" }, "to": { "elementId": "smoke" } },
    { "id": "e7", "kind": "edge", "from": { "elementId": "smoke" }, "to": { "elementId": "shift" }, "label": "yes" },
    { "id": "e8", "kind": "edge", "from": { "elementId": "smoke" }, "to": { "elementId": "rollback" }, "label": "no" },
    { "id": "e9", "kind": "edge", "from": { "elementId": "shift" }, "to": { "elementId": "errOk" } },
    { "id": "e10", "kind": "edge", "from": { "elementId": "errOk" }, "to": { "elementId": "full" }, "label": "yes" },
    { "id": "e11", "kind": "edge", "from": { "elementId": "errOk" }, "to": { "elementId": "rollback" }, "label": "no" },
    { "id": "e12", "kind": "edge", "from": { "elementId": "full" }, "to": { "elementId": "done" }, "label": "yes" },
    { "id": "e13", "kind": "edge", "from": { "elementId": "full" }, "to": { "elementId": "shift" }, "label": "no" },
    { "id": "e14", "kind": "edge", "from": { "elementId": "rollback" }, "to": { "elementId": "notify" } },
    { "id": "e15", "kind": "edge", "from": { "elementId": "notify" }, "to": { "elementId": "failed" } },
    { "id": "e16", "kind": "edge", "from": { "elementId": "fix" }, "to": { "elementId": "failed" } }
  ]
}
