From f8f22de2808a88162be6cdf314e1da38a4bb7209 Mon Sep 17 00:00:00 2001 From: Marcos Oliveira Date: Sun, 15 Nov 2026 18:30:30 -0500 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20pattern=203=20(CI-CD)=20page=20live?= =?UTF-8?q?=20=E2=80=94=2012=20of=2012=20patterns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Gateway /api/patterns/delivery: each running service's build commit compared with the latest commit on main (current / behind / local / unknown), plus the latest CI and Deploy runs on main, from GitHub's public API, cached 60 s. Built test-first; GitHub stubbed in tests. - CI-CD pattern page: problem, how this project does it, when not to use it, live demo. - README, Home and Patterns say all 12 are live; screenshot p03-ci-cd.jpg. Closes #10 Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 6 +- README.md | 16 ++- docs/screenshots/p03-ci-cd.jpg | Bin 0 -> 54506 bytes frontend/src/api/gatewayClient.ts | 22 +++++ frontend/src/pages/Home.tsx | 2 +- frontend/src/pages/PatternPage.tsx | 2 + frontend/src/pages/Patterns.tsx | 2 +- frontend/src/patterns/content.ts | 24 ++++- frontend/src/patterns/demos/CiCdDemo.tsx | 121 +++++++++++++++++++++++ gateway/app/main.py | 3 +- gateway/app/routers/delivery.py | 71 +++++++++++++ gateway/tests/test_delivery.py | 56 +++++++++++ 12 files changed, 314 insertions(+), 11 deletions(-) create mode 100644 docs/screenshots/p03-ci-cd.jpg create mode 100644 frontend/src/patterns/demos/CiCdDemo.tsx create mode 100644 gateway/app/routers/delivery.py create mode 100644 gateway/tests/test_delivery.py diff --git a/CLAUDE.md b/CLAUDE.md index f06cc5e..cab0948 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,7 +27,7 @@ history, monolith dropped). The full agreed plan is in [`docs/PLAN.md`](docs/PLA - Name prefix: `ms12p` (parent uses `flaskms`). Teardown deletes the whole resource group, so a shared name would delete the other project. -## Current state (M3a: every pattern except 3 is live) +## Current state (M3b: all 12 patterns live locally; Azure run is #11) - Folders: `services/{user,catalog,order,payment,inventory}/` (Flask, one DB each), `gateway/` (FastAPI), `registry/` (FastAPI), `shared/` (`shop_common`), `contracts/`, `frontend/`, `infra/`, `scripts/`, `tests/`. @@ -56,7 +56,9 @@ history, monolith dropped). The full agreed plan is in [`docs/PLAN.md`](docs/PLA GitHub secrets so they stay masked in public logs); `scripts/deploy_plan.py` picks services whose code changed since their running commit (CI-only files rebuild nothing) and waits until each service answers `/debug/runtime` with the new commit. All workflow actions are pinned to commit SHAs. "CI ok" -is the one job to require in branch protection. +is the one job to require in branch protection. The CI-CD page reads `/api/patterns/delivery` +(gateway `routers/delivery.py`): running commits vs main and the latest runs, from GitHub's public +API, cached 60 s (`GITHUB_REPO` overrides the repo). - Azure (M3b): provision keeps `image_tag`, `image_sizes` and `jwt_key_b64` in infra/.state.json so `--skip-build` and re-runs neither break image pulls nor log users out. It tags images with the 12-char commit, imports `redis:7.4-alpine` into ACR, generates the JWT key (`openssl`, passed base64 as a secure param, user reads `JWT_PRIVATE_KEY_B64`), diff --git a/README.md b/README.md index e7e79cb..ed6413f 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,10 @@ A small Contoso e-commerce system that shows **12 microservices patterns working Each pattern gets its own page with an explanation, when *not* to use it, and a live demo you can click. -> **Status: M3a, async and packaging.** 11 of 12 patterns are live. M3a adds the Saga, -> Event-Driven Architecture and Containerization to M1 (patterns 1, 2, 5, 6) and M2 (4, 10, 11, 12). -> The foundation is copied from +> **Status: M3b, delivery.** All 12 patterns are live locally, each with a working demo. The +> first real Azure run is the last step (issue #11). The foundation is copied from > [Azure-Ecommerce-Monolith-Microservices-Migration](https://github.com/MAOFILHO/Azure-Ecommerce-Monolith-Microservices-Migration). -> CI-CD and the Azure run arrive in M3b. See [docs/PLAN.md](docs/PLAN.md). +> See [docs/PLAN.md](docs/PLAN.md) and the [M3b issues](https://github.com/MAOFILHO/Microservices-12-Patterns/issues). ## The 12 patterns @@ -16,7 +15,7 @@ can click. |---|---|---|---| | 1 | Database per Service | Gives each service its own database | **Live (M1)** | | 2 | Bounded Context | Splits one large domain into clear business domains | **Live (M1)** | -| 3 | CI-CD Pipeline | Builds, tests and deploys every service automatically | M3b | +| 3 | CI-CD Pipeline | Builds, tests and deploys every service automatically | **Live (M3b)** | | 4 | Circuit Breaker | Stops calls to a failing service to prevent more failures | **Live (M2)** | | 5 | API Gateway | Routes client requests to the right service | **Live (M1)** | | 6 | Observability | Collects logs, metrics and traces from every service | **Live (M1)** | @@ -82,6 +81,13 @@ database queries, drawn as a waterfall. Metrics per service come from each `/met Observability demo: a trace waterfall across gateway, user, order, catalog and inventory +### 3. CI-CD Pipeline +Which commit each running service was built from, compared with the latest commit on main, and +the latest CI and Deploy runs, read from GitHub. Locally every process is a "local build"; in Azure +each image carries its commit, so a service that is behind main shows up at once. + +CI-CD demo: each service's build commit compared with main, and the latest CI and Deploy runs + ### 4. Circuit Breaker Switch payment to slow and send 10 calls. Each order replica's breaker opens after 3 failures. A real failure took 2,215 ms; a call the open breaker stopped took 0 ms. After 15 s with payment diff --git a/docs/screenshots/p03-ci-cd.jpg b/docs/screenshots/p03-ci-cd.jpg new file mode 100644 index 0000000000000000000000000000000000000000..572f30b2ba2799dcbbc0b0806bd326d19d82aeba GIT binary patch literal 54506 zcmdpe1y~$Sy6)f*JU9&Q8r&rWw*+^07~B&eBoN#QZXvk4%#h%&!JXjl5-cR#A^Gob zdv@>H^Y5N}?rk1=s>}M5>Y1wVeXH+g?v?>q^3rnB02mkm00#O8xLbuKl#`G!QdWH? zEvG2;qW~5e06pN@0RVdkHy2fzCluN`x)eyuKU>_FnV7jc-GBa_1KRJ!)P3&&z&PvQ zsq>GrQOqq|&7c*Iq5tMC(3?YrRfnc=t$wDh@6)C~(?0iUPd6twXq}k*w2Qi`1T>us zO*2^iE^Yd|w3(C3ef>db9btPr_xpR@ANLZYSvY8@K|iIT|3H8wzy{z7a01u?OaRXT z6aZxa7xXLxy|M?m1Kgl#PiPG{fHgGb3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`T&|+Bx@%~h9>{y_(Uof+y zvR?@`)csaO1U9IvMKJQ5LIV1KqG5U88ln@LrxR~qwg$uw||3GEnv^i9vWwGNwN&5nD!W}qcRFDa6|_n%eTDK!b&gR|D%k5*eqO@t?v0`L<$ zU|>Qd-gm7{br^`0JByDJZLFrum5_$#@*al5yhI7G3~djwZ-CY@mkFGX?i>xGg($qt zIEJmA{AqZ6w5teATH3HNboSeQ8D&t`Q;MQ>C76Y1 zY5-EI6EE9pIz*Q-!F|~ZBF|q_#y?L#HI`{lNgqG1Ro{3hB1sydaC)Jk=Jawx*&tVd zl^f0o$%j);BG#=yTu#1%_P&k^HX0H8Diht*L`=C7aTxLA)fH`8f37s&{x2tuo7lG# z-7X!d5Oo~=n32$jlbYyxQ~s2&L-~`tm_4|60LArI#>$c|x5To>->05JLo?TB8fpok zXYOfrR<+*f;y&8?qKR7%2G8r$IX-FqtP@R!6PBc@x3;30jLb8v9 zsk&80J#fugJP-q@oGT;{mP~PHYcSK`K7GsB|9cgVjILD$-}S9)|;gO0&?a}vn* zbg^j+HL=r;_{(<1@*pfE)yOHxjjz}LO1H<&iF(GEmR$$0DTpv@=68#R+K=VIjo76g zx6wI9sPl*f+pe!MBDauV2T>?rkyRJ?N#q<&`Q{1PE46nErZ0(qxH;D(RhV?i6D9li zl-YK1g;(X?_qZL150vvxvlch^;j`|*_cUl^sM_TV9GR_3*1Xnng`!yEonYOzQW@>2 z3&dAZ{4$^7N-2Ztl{X7DbNZ@DEIyuhPAB0R(fP(lzhoEiXSZ4CW~nO@m-kWL$@1p4 zE1`}Bn~TJ0Z}B|HtsDP0yR!!(sF$?5rXl3Zp`kXN&*vALjLlEe4;?~IjH%!sYGXfC z&CdW+2-|bzsVD8u~hMWZ|^T#qA=zT#P0UJG;dUs&X>i2wiq literal 0 HcmV?d00001 diff --git a/frontend/src/api/gatewayClient.ts b/frontend/src/api/gatewayClient.ts index 70dcd2c..846aa58 100644 --- a/frontend/src/api/gatewayClient.ts +++ b/frontend/src/api/gatewayClient.ts @@ -311,3 +311,25 @@ export const asyncApi = { }), runtime: () => request<{ processes: RuntimeInfo[] }>("/api/patterns/runtime"), }; + +// --- M3b demo endpoint (pattern 3) --------------------------------------------------------------- + +export interface WorkflowRun { + workflow: string; + status: string; + conclusion: string | null; + commit: string; + url: string; + created_at: string; +} + +export interface DeliveryView { + repo: string; + main: { sha: string; short: string; url: string } | null; + services: { service: string; instance: string; git_sha: string | null; status: "current" | "behind" | "local" | "unknown" }[]; + runs: { ci: WorkflowRun | null; deploy: WorkflowRun | null }; +} + +export const deliveryApi = { + view: () => request("/api/patterns/delivery"), +}; diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index fa8bff0..03f6e1f 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -18,7 +18,7 @@ export default function Home() {

Patterns

-

The 12 patterns. 11 are live now; CI-CD arrives in M3b.

+

The 12 patterns. All 12 are live, each with a working demo.

diff --git a/frontend/src/pages/PatternPage.tsx b/frontend/src/pages/PatternPage.tsx index 7874e03..a15224c 100644 --- a/frontend/src/pages/PatternPage.tsx +++ b/frontend/src/pages/PatternPage.tsx @@ -2,6 +2,7 @@ import { ReactNode } from "react"; import { Link, useParams } from "react-router-dom"; import ApiGatewayDemo from "../patterns/demos/ApiGatewayDemo"; import BoundedContextDemo from "../patterns/demos/BoundedContextDemo"; +import CiCdDemo from "../patterns/demos/CiCdDemo"; import CircuitBreakerDemo from "../patterns/demos/CircuitBreakerDemo"; import ContainerizationDemo from "../patterns/demos/ContainerizationDemo"; import ContractTestingDemo from "../patterns/demos/ContractTestingDemo"; @@ -25,6 +26,7 @@ const DEMOS: Record ReactNode> = { "event-driven-architecture": () => , saga: () => , containerization: () => , + "ci-cd-pipeline": () => , }; export default function PatternPage() { diff --git a/frontend/src/pages/Patterns.tsx b/frontend/src/pages/Patterns.tsx index 5ca1ef6..4a0afbe 100644 --- a/frontend/src/pages/Patterns.tsx +++ b/frontend/src/pages/Patterns.tsx @@ -9,7 +9,7 @@ export default function Patterns() {

The 12 patterns

Each pattern has a page that explains it, says when not to use it, and runs a live demo against the real - services. {liveCount} of 12 are live; the last one, CI-CD, arrives in milestone M3b. + services. {liveCount} of 12 are live; every one has a working demo.

diff --git a/frontend/src/patterns/content.ts b/frontend/src/patterns/content.ts index 1e073ab..631ba8b 100644 --- a/frontend/src/patterns/content.ts +++ b/frontend/src/patterns/content.ts @@ -56,7 +56,29 @@ export const PATTERNS: PatternInfo[] = [ ], source: { label: "Martin Fowler — BoundedContext", url: "https://martinfowler.com/bliki/BoundedContext.html" }, }, - { n: 3, slug: "ci-cd-pipeline", name: "CI-CD Pipeline", what: "Builds, tests and deploys every service automatically.", milestone: "M3", live: false }, + { + n: 3, + slug: "ci-cd-pipeline", + name: "CI-CD Pipeline", + what: "Builds, tests and deploys every service automatically.", + milestone: "M3", + live: true, + problem: + "With 6 services, building and testing everything on every change is slow, and deploying by hand from a laptop is error-prone: nobody knows which version runs where, and one tired evening ships the wrong one.", + inThisProject: [ + "Every pull request first plans its jobs from the changed files and the service table: a change to the payment service runs payment's tests and image only.", + "Shared code, CI itself or the service table run everything. Changing the contract consumer also runs every provider's contract check.", + "Every image is built for linux/amd64 in CI, started, health-checked, and rejected if it runs as root.", + "Deploy is a manual workflow on main. It signs in to Azure with OIDC (no stored password), rebuilds only the services that changed since the commit they run, and waits until each answers with the new commit.", + "Every running service reports the commit it was built from, so this page can show what is live and what is behind.", + ], + whenNotToUse: [ + "Path-based skipping trusts the folder layout. Code that one service imports from another folder must be declared, or a change can skip a test it should run.", + "Manual deploys suit a demo. A busy team usually deploys every merge automatically, behind tests and feature flags.", + "Rebuilding only what changed assumes services are independent. Breaking API changes still need contract tests and a deploy order.", + ], + source: { label: "Martin Fowler — Continuous Delivery", url: "https://martinfowler.com/bliki/ContinuousDelivery.html" }, + }, { n: 4, slug: "circuit-breaker", diff --git a/frontend/src/patterns/demos/CiCdDemo.tsx b/frontend/src/patterns/demos/CiCdDemo.tsx new file mode 100644 index 0000000..2d221f4 --- /dev/null +++ b/frontend/src/patterns/demos/CiCdDemo.tsx @@ -0,0 +1,121 @@ +import { useEffect, useState } from "react"; +import { DeliveryView, WorkflowRun, deliveryApi } from "../../api/gatewayClient"; + +const PILL: Record = { current: "done", behind: "failed", local: "pending", unknown: "pending" }; +const LABEL: Record = { + current: "on latest main", + behind: "behind main", + local: "local build", + unknown: "unknown", +}; + +function Run({ title, run }: { title: string; run: WorkflowRun | null }) { + return ( +
+

{title}

+ {run ? ( +

+ + {run.conclusion ?? run.status} + {" "} + commit {run.commit} · {new Date(run.created_at).toLocaleString()} ·{" "} + + open the run + +

+ ) : ( +

+ No run on main yet, or GitHub is unreachable. +

+ )} +
+ ); +} + +export default function CiCdDemo() { + const [view, setView] = useState(null); + const [error, setError] = useState(null); + + useEffect(() => { + deliveryApi + .view() + .then(setView) + .catch((err) => setError(String(err))); + }, []); + + const behind = view?.services.filter((s) => s.status === "behind").length ?? 0; + + return ( +
+ {error &&

{error}

} +
+

What each running service was built from

+

+ Latest commit on main:{" "} + {view?.main ? ( + + {view.main.short} + + ) : ( + "unknown (GitHub unreachable)" + )} + . {behind > 0 ? `${behind} service(s) run an older build: press Deploy to roll them forward.` : ""} +

+
+ + + + + + + + + + {view?.services.map((s) => ( + + + + + + ))} + +
ServiceBuilt fromCompared with main
+ + {s.instance} + + {s.git_sha ?? "–"} + + {LABEL[s.status]} +
+
+

+ Locally every process says "local build": make run starts the code from your working copy. In Azure, each + image carries the commit it was built from. +

+
+ +
+ + +
+ +
+

The pipeline

+
    +
  1. + Pull request: a planning job reads the changed files and the service table, then runs only + the unit tests, contract checks and container builds that change touches. Shared code runs everything. +
  2. +
  3. + Merge to main: everything runs once more. One job, "CI ok", sums it all up. +
  4. +
  5. + Deploy (a person presses the button): signs in to Azure with OIDC (no stored password), + rebuilds only the services whose code changed since the commit they run, rolls them out, and waits until + each one answers with the new commit. +
  6. +
+
+
+ ); +} diff --git a/gateway/app/main.py b/gateway/app/main.py index e1ed06d..3d80996 100644 --- a/gateway/app/main.py +++ b/gateway/app/main.py @@ -4,7 +4,7 @@ from shop_common.discovery import DISCOVERY from . import config, observability -from .routers import patterns, resilience, services, shop +from .routers import delivery, patterns, resilience, services, shop app = FastAPI( title="Microservices 12 Patterns — API Gateway", @@ -32,6 +32,7 @@ app.include_router(shop.router) app.include_router(patterns.router) app.include_router(resilience.router) +app.include_router(delivery.router) app.include_router(services.router) diff --git a/gateway/app/routers/delivery.py b/gateway/app/routers/delivery.py new file mode 100644 index 0000000..37aee78 --- /dev/null +++ b/gateway/app/routers/delivery.py @@ -0,0 +1,71 @@ +"""Live demo endpoint for pattern 3 (CI-CD). + +Which commit each running service was built from, compared with the latest commit on main, and +the latest CI and Deploy runs. GitHub data comes from its public REST API (this repo is public, so +no token), cached for 60 s to stay far below the 60-requests-per-hour anonymous limit. +""" +import os +import time + +import httpx +from fastapi import APIRouter, Request + +from .resilience import runtime as runtime_endpoint + +router = APIRouter(prefix="/api/patterns", tags=["patterns"]) + +GITHUB_REPO = os.environ.get("GITHUB_REPO", "MAOFILHO/Microservices-12-Patterns") +CACHE_SECONDS = 60 +WORKFLOWS = {"ci": "ci.yml", "deploy": "deploy.yml"} +_cache: dict[str, tuple[float, object]] = {} + + +async def github_get(path: str): + """GET api.github.com, cached; None when GitHub is unreachable or says no.""" + hit = _cache.get(path) + if hit and time.monotonic() - hit[0] < CACHE_SECONDS: + return hit[1] + try: + async with httpx.AsyncClient(timeout=5) as client: + response = await client.get(f"https://api.github.com{path}", + headers={"Accept": "application/vnd.github+json"}) + body = response.json() if response.status_code == 200 else None + except (httpx.HTTPError, ValueError): + body = None + _cache[path] = (time.monotonic(), body) + return body + + +async def process_runtimes(request: Request) -> list[dict]: + return (await runtime_endpoint(request))["processes"] + + +def _status(process: dict, main_sha: str | None) -> str: + commit = process.get("git_sha") + if process.get("unreachable") or not commit or commit == "unknown": + return "unknown" + if commit == "local": + return "local" + if main_sha is None: + return "unknown" + return "current" if main_sha.startswith(commit) else "behind" + + +async def _latest_run(name: str, file: str) -> dict | None: + body = await github_get(f"/repos/{GITHUB_REPO}/actions/workflows/{file}/runs?branch=main&per_page=1") + runs = (body or {}).get("workflow_runs") or [] + if not runs: + return None + run = runs[0] + return {"workflow": name, "status": run["status"], "conclusion": run["conclusion"], + "commit": run["head_sha"][:12], "url": run["html_url"], "created_at": run["created_at"]} + + +@router.get("/delivery") +async def delivery(request: Request): + head = await github_get(f"/repos/{GITHUB_REPO}/commits/main") + main = {"sha": head["sha"], "short": head["sha"][:12], "url": head["html_url"]} if head else None + services = [{"service": p["service"], "instance": p["instance"], "git_sha": p.get("git_sha"), + "status": _status(p, main["sha"] if main else None)} for p in await process_runtimes(request)] + runs = {name: await _latest_run(name, file) for name, file in WORKFLOWS.items()} + return {"repo": GITHUB_REPO, "main": main, "services": services, "runs": runs} diff --git a/gateway/tests/test_delivery.py b/gateway/tests/test_delivery.py new file mode 100644 index 0000000..69fea20 --- /dev/null +++ b/gateway/tests/test_delivery.py @@ -0,0 +1,56 @@ +"""#10: the CI-CD page. Which commit each service runs, compared with the latest commit on main, +plus the latest CI and Deploy runs. GitHub is stubbed: no network in unit tests.""" +import pytest +from fastapi.testclient import TestClient + +from app.main import app +from app.routers import delivery + +client = TestClient(app) +MAIN = "abc123def4567890abc123def4567890abc12345" + + +@pytest.fixture(autouse=True) +def _stub(monkeypatch): + delivery._cache.clear() + + async def runtime(request): + return [ + {"service": "gateway", "instance": "gateway", "git_sha": "abc123def456"}, + {"service": "order", "instance": "order-1", "git_sha": "0ld0ld0ld0ld"}, + {"service": "user", "instance": "user-5101", "git_sha": "local"}, + {"service": "payment", "instance": "payment-1", "unreachable": True}, + ] + + async def github(path): + if path.endswith("/commits/main"): + return {"sha": MAIN, "html_url": "https://github.com/x/commit/abc"} + return {"workflow_runs": [{"status": "completed", "conclusion": "success", "head_sha": MAIN, + "html_url": f"https://github.com/x/runs/{path.split('/')[-2]}", + "created_at": "2026-11-15T20:00:00Z"}]} + + monkeypatch.setattr(delivery, "process_runtimes", runtime) + monkeypatch.setattr(delivery, "github_get", github) + + +def test_each_service_is_marked_current_behind_local_or_unknown(): + body = client.get("/api/patterns/delivery").json() + status = {s["instance"]: s["status"] for s in body["services"]} + assert status == {"gateway": "current", "order-1": "behind", "user-5101": "local", "payment-1": "unknown"} + assert body["main"]["short"] == MAIN[:12] + + +def test_latest_ci_and_deploy_runs_are_linked(): + runs = client.get("/api/patterns/delivery").json()["runs"] + assert runs["ci"]["conclusion"] == "success" and runs["ci"]["url"].endswith("ci.yml") + assert runs["deploy"]["url"].endswith("deploy.yml") + + +def test_github_unreachable_still_shows_the_services(monkeypatch): + async def down(path): + return None + + monkeypatch.setattr(delivery, "github_get", down) + body = client.get("/api/patterns/delivery").json() + assert body["main"] is None and body["runs"] == {"ci": None, "deploy": None} + assert {s["status"] for s in body["services"]} <= {"unknown", "local"} From 7730466f92c096787cab7aae3c375829324f708f Mon Sep 17 00:00:00 2001 From: Marcos Oliveira Date: Sun, 15 Nov 2026 18:41:45 -0500 Subject: [PATCH 2/2] fix: CI-CD page code-review findings, test-first - "behind main" now uses Deploy's rule: only when main changed the service's folder or shared code since its build; otherwise "no changes since its build". No more false "press Deploy" alarms. - GitHub calls run in parallel, are reused for 5 minutes and then revalidated with their ETag (a 304 does not use the 60-per-hour anonymous limit); on 403/5xx the last good answer is kept; odd or non-JSON replies give "unknown", never a 500. - Tests fake GitHub at the HTTP layer (httpx.MockTransport), so caching, ETags and errors are tested. - Runtime fan-out shared through resilience.collect_runtimes; loading state and typed status maps on the page; copy fixes. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- frontend/src/api/gatewayClient.ts | 5 +- frontend/src/patterns/content.ts | 4 +- frontend/src/patterns/demos/CiCdDemo.tsx | 27 ++++-- gateway/app/routers/delivery.py | 107 ++++++++++++++++------- gateway/app/routers/resilience.py | 10 ++- gateway/tests/test_delivery.py | 107 +++++++++++++++++------ 7 files changed, 187 insertions(+), 75 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index cab0948..17b5a52 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -58,7 +58,7 @@ history, monolith dropped). The full agreed plan is in [`docs/PLAN.md`](docs/PLA answers `/debug/runtime` with the new commit. All workflow actions are pinned to commit SHAs. "CI ok" is the one job to require in branch protection. The CI-CD page reads `/api/patterns/delivery` (gateway `routers/delivery.py`): running commits vs main and the latest runs, from GitHub's public -API, cached 60 s (`GITHUB_REPO` overrides the repo). +API, reused 5 min then revalidated by ETag (304s are free), last good answer kept on errors; "behind" uses the Deploy rule (`GITHUB_REPO` overrides the repo). - Azure (M3b): provision keeps `image_tag`, `image_sizes` and `jwt_key_b64` in infra/.state.json so `--skip-build` and re-runs neither break image pulls nor log users out. It tags images with the 12-char commit, imports `redis:7.4-alpine` into ACR, generates the JWT key (`openssl`, passed base64 as a secure param, user reads `JWT_PRIVATE_KEY_B64`), diff --git a/frontend/src/api/gatewayClient.ts b/frontend/src/api/gatewayClient.ts index 846aa58..29c3e70 100644 --- a/frontend/src/api/gatewayClient.ts +++ b/frontend/src/api/gatewayClient.ts @@ -323,10 +323,13 @@ export interface WorkflowRun { created_at: string; } +/** current: built from main. behind: main changed its code. unchanged: older build, nothing of it changed. */ +export type DeliveryStatus = "current" | "behind" | "unchanged" | "local" | "unknown"; + export interface DeliveryView { repo: string; main: { sha: string; short: string; url: string } | null; - services: { service: string; instance: string; git_sha: string | null; status: "current" | "behind" | "local" | "unknown" }[]; + services: { service: string; instance: string; git_sha: string | null; status: DeliveryStatus }[]; runs: { ci: WorkflowRun | null; deploy: WorkflowRun | null }; } diff --git a/frontend/src/patterns/content.ts b/frontend/src/patterns/content.ts index 631ba8b..8169dba 100644 --- a/frontend/src/patterns/content.ts +++ b/frontend/src/patterns/content.ts @@ -64,13 +64,13 @@ export const PATTERNS: PatternInfo[] = [ milestone: "M3", live: true, problem: - "With 6 services, building and testing everything on every change is slow, and deploying by hand from a laptop is error-prone: nobody knows which version runs where, and one tired evening ships the wrong one.", + "With 5 services and a gateway, building and testing everything on every change is slow, and deploying by hand from a laptop is error-prone: nobody knows which version runs where, and one tired evening ships the wrong one.", inThisProject: [ "Every pull request first plans its jobs from the changed files and the service table: a change to the payment service runs payment's tests and image only.", "Shared code, CI itself or the service table run everything. Changing the contract consumer also runs every provider's contract check.", "Every image is built for linux/amd64 in CI, started, health-checked, and rejected if it runs as root.", "Deploy is a manual workflow on main. It signs in to Azure with OIDC (no stored password), rebuilds only the services that changed since the commit they run, and waits until each answers with the new commit.", - "Every running service reports the commit it was built from, so this page can show what is live and what is behind.", + "Every running service reports the commit it was built from. This page marks a service behind main only when main changed its code since that build, the same rule Deploy uses.", ], whenNotToUse: [ "Path-based skipping trusts the folder layout. Code that one service imports from another folder must be declared, or a change can skip a test it should run.", diff --git a/frontend/src/patterns/demos/CiCdDemo.tsx b/frontend/src/patterns/demos/CiCdDemo.tsx index 2d221f4..b3635f8 100644 --- a/frontend/src/patterns/demos/CiCdDemo.tsx +++ b/frontend/src/patterns/demos/CiCdDemo.tsx @@ -1,10 +1,17 @@ import { useEffect, useState } from "react"; -import { DeliveryView, WorkflowRun, deliveryApi } from "../../api/gatewayClient"; +import { DeliveryStatus, DeliveryView, WorkflowRun, deliveryApi } from "../../api/gatewayClient"; -const PILL: Record = { current: "done", behind: "failed", local: "pending", unknown: "pending" }; -const LABEL: Record = { +const PILL: Record = { + current: "done", + unchanged: "done", + behind: "failed", + local: "pending", + unknown: "pending", +}; +const LABEL: Record = { current: "on latest main", - behind: "behind main", + unchanged: "no changes since its build", + behind: "behind main: Deploy rebuilds it", local: "local build", unknown: "unknown", }; @@ -37,12 +44,18 @@ export default function CiCdDemo() { const [error, setError] = useState(null); useEffect(() => { + let active = true; deliveryApi .view() - .then(setView) - .catch((err) => setError(String(err))); + .then((v) => active && setView(v)) + .catch((err) => active && setError(String(err))); + return () => { + active = false; + }; }, []); + if (!view && !error) return

Reading the running services and GitHub…

; + const behind = view?.services.filter((s) => s.status === "behind").length ?? 0; return ( @@ -59,7 +72,7 @@ export default function CiCdDemo() { ) : ( "unknown (GitHub unreachable)" )} - . {behind > 0 ? `${behind} service(s) run an older build: press Deploy to roll them forward.` : ""} + . {behind > 0 ? `${behind} service(s) are behind main: the Deploy button rebuilds exactly those.` : ""}

diff --git a/gateway/app/routers/delivery.py b/gateway/app/routers/delivery.py index 37aee78..1bb4b71 100644 --- a/gateway/app/routers/delivery.py +++ b/gateway/app/routers/delivery.py @@ -2,45 +2,78 @@ Which commit each running service was built from, compared with the latest commit on main, and the latest CI and Deploy runs. GitHub data comes from its public REST API (this repo is public, so -no token), cached for 60 s to stay far below the 60-requests-per-hour anonymous limit. +no token). Anonymous callers get 60 requests an hour, so every answer is reused for 5 minutes and +then re-checked with its ETag: an unchanged answer (304) does not count against that limit. If +GitHub refuses or fails, the last good answer is kept. """ +import asyncio import os import time import httpx from fastapi import APIRouter, Request -from .resilience import runtime as runtime_endpoint +from .resilience import collect_runtimes router = APIRouter(prefix="/api/patterns", tags=["patterns"]) GITHUB_REPO = os.environ.get("GITHUB_REPO", "MAOFILHO/Microservices-12-Patterns") -CACHE_SECONDS = 60 +CACHE_SECONDS = 300 WORKFLOWS = {"ci": "ci.yml", "deploy": "deploy.yml"} -_cache: dict[str, tuple[float, object]] = {} +TRANSPORT: httpx.AsyncBaseTransport | None = None # tests swap in a fake GitHub +_cache: dict[str, dict] = {} # path -> {"body", "etag", "fetched_at"}; a handful of fixed paths + +# The same rule the Deploy workflow uses (scripts/ci_changes.py, not shipped in this image): a +# service needs a new build when a change touches its folder or code every service shares. +EVERY_SERVICE = ("shared/", "scripts/service_table.py") + + +def _folder(service: str) -> str: + return "gateway/" if service == "gateway" else f"services/{service}/" async def github_get(path: str): - """GET api.github.com, cached; None when GitHub is unreachable or says no.""" - hit = _cache.get(path) - if hit and time.monotonic() - hit[0] < CACHE_SECONDS: - return hit[1] + """GET api.github.com, reused for CACHE_SECONDS, then revalidated with its ETag.""" + entry = _cache.get(path) + if entry and time.monotonic() - entry["fetched_at"] < CACHE_SECONDS: + return entry["body"] + headers = {"Accept": "application/vnd.github+json"} + if entry and entry.get("etag"): + headers["If-None-Match"] = entry["etag"] try: - async with httpx.AsyncClient(timeout=5) as client: - response = await client.get(f"https://api.github.com{path}", - headers={"Accept": "application/vnd.github+json"}) - body = response.json() if response.status_code == 200 else None + async with httpx.AsyncClient(timeout=5, transport=TRANSPORT) as client: + response = await client.get(f"https://api.github.com{path}", headers=headers) + if response.status_code == 304 and entry: + body, etag = entry["body"], entry.get("etag") + elif response.status_code == 200: + body, etag = response.json(), response.headers.get("ETag") + else: # rate limited or down: keep the last good answer, if any + body, etag = (entry or {}).get("body"), (entry or {}).get("etag") except (httpx.HTTPError, ValueError): - body = None - _cache[path] = (time.monotonic(), body) + body, etag = (entry or {}).get("body"), (entry or {}).get("etag") + _cache[path] = {"body": body, "etag": etag, "fetched_at": time.monotonic()} return body -async def process_runtimes(request: Request) -> list[dict]: - return (await runtime_endpoint(request))["processes"] +async def _latest_run(name: str, file: str) -> dict | None: + body = await github_get(f"/repos/{GITHUB_REPO}/actions/workflows/{file}/runs?branch=main&per_page=1") + runs = body.get("workflow_runs") if isinstance(body, dict) else None + run = runs[0] if runs else None + if not isinstance(run, dict) or not run.get("html_url"): + return None + return {"workflow": name, "status": run.get("status"), "conclusion": run.get("conclusion"), + "commit": (run.get("head_sha") or "")[:12], "url": run["html_url"], "created_at": run.get("created_at")} + + +async def _changed_files(commit: str, main_sha: str) -> list[str] | None: + body = await github_get(f"/repos/{GITHUB_REPO}/compare/{commit}...{main_sha}") + files = body.get("files") if isinstance(body, dict) else None + return [f.get("filename", "") for f in files] if isinstance(files, list) else None -def _status(process: dict, main_sha: str | None) -> str: +def _status(process: dict, main_sha: str | None, changed: dict[str, list[str] | None]) -> str: + """current: built from main. behind: main has changes for it (Deploy would rebuild it). + unchanged: built from an older commit, but nothing of its code changed since. local / unknown.""" commit = process.get("git_sha") if process.get("unreachable") or not commit or commit == "unknown": return "unknown" @@ -48,24 +81,32 @@ def _status(process: dict, main_sha: str | None) -> str: return "local" if main_sha is None: return "unknown" - return "current" if main_sha.startswith(commit) else "behind" - - -async def _latest_run(name: str, file: str) -> dict | None: - body = await github_get(f"/repos/{GITHUB_REPO}/actions/workflows/{file}/runs?branch=main&per_page=1") - runs = (body or {}).get("workflow_runs") or [] - if not runs: - return None - run = runs[0] - return {"workflow": name, "status": run["status"], "conclusion": run["conclusion"], - "commit": run["head_sha"][:12], "url": run["html_url"], "created_at": run["created_at"]} + if main_sha.startswith(commit): + return "current" + files = changed.get(commit) + if files is None: + return "unknown" + touches = (_folder(process["service"]), *EVERY_SERVICE) + return "behind" if any(f.startswith(touches) for f in files) else "unchanged" @router.get("/delivery") async def delivery(request: Request): - head = await github_get(f"/repos/{GITHUB_REPO}/commits/main") - main = {"sha": head["sha"], "short": head["sha"][:12], "url": head["html_url"]} if head else None + head, ci, deploy, processes = await asyncio.gather( + github_get(f"/repos/{GITHUB_REPO}/commits/main"), + _latest_run("ci", WORKFLOWS["ci"]), + _latest_run("deploy", WORKFLOWS["deploy"]), + collect_runtimes(request), + ) + main_sha = head.get("sha") if isinstance(head, dict) else None + main = {"sha": main_sha, "short": main_sha[:12], "url": head.get("html_url")} if main_sha else None + + older = sorted({p.get("git_sha") for p in processes + if p.get("git_sha") and p.get("git_sha") not in ("local", "unknown") + and not (main_sha or "").startswith(p.get("git_sha"))}) + compared = await asyncio.gather(*(_changed_files(c, main_sha) for c in older)) if main_sha else [] + changed = dict(zip(older, compared)) + services = [{"service": p["service"], "instance": p["instance"], "git_sha": p.get("git_sha"), - "status": _status(p, main["sha"] if main else None)} for p in await process_runtimes(request)] - runs = {name: await _latest_run(name, file) for name, file in WORKFLOWS.items()} - return {"repo": GITHUB_REPO, "main": main, "services": services, "runs": runs} + "status": _status(p, main_sha, changed)} for p in processes] + return {"repo": GITHUB_REPO, "main": main, "services": services, "runs": {"ci": ci, "deploy": deploy}} diff --git a/gateway/app/routers/resilience.py b/gateway/app/routers/resilience.py index d20caa5..eaaf201 100644 --- a/gateway/app/routers/resilience.py +++ b/gateway/app/routers/resilience.py @@ -178,8 +178,7 @@ async def set_bus(body: BusSwitch): # --- Pattern 9: Containerization --------------------------------------------------------------- -@router.get("/runtime") -async def runtime(request: Request): +async def collect_runtimes(request: Request) -> list[dict]: """How every process runs: as root or not, in a container or not, which build (git SHA).""" async def one(service: str, base: str) -> dict: try: @@ -191,4 +190,9 @@ async def one(service: str, base: str) -> dict: async with _client() as client: targets = [(n, url) for n in config.SERVICE_BASE_URLS for url in config.urls_for(n)] services = await asyncio.gather(*(one(n, url) for n, url in targets)) - return {"processes": [runtime_info("gateway", "gateway"), *services]} + return [runtime_info("gateway", "gateway"), *services] + + +@router.get("/runtime") +async def runtime(request: Request): + return {"processes": await collect_runtimes(request)} diff --git a/gateway/tests/test_delivery.py b/gateway/tests/test_delivery.py index 69fea20..a4b4973 100644 --- a/gateway/tests/test_delivery.py +++ b/gateway/tests/test_delivery.py @@ -1,5 +1,8 @@ -"""#10: the CI-CD page. Which commit each service runs, compared with the latest commit on main, -plus the latest CI and Deploy runs. GitHub is stubbed: no network in unit tests.""" +"""Pattern 3 page: which commit each service runs, compared with main the way Deploy decides, plus +the latest CI and Deploy runs. GitHub is faked at the HTTP layer: no network in unit tests.""" +import asyncio + +import httpx import pytest from fastapi.testclient import TestClient @@ -8,49 +11,97 @@ client = TestClient(app) MAIN = "abc123def4567890abc123def4567890abc12345" +REPO = delivery.GITHUB_REPO + + +def github_reply(request: httpx.Request) -> httpx.Response: + """A fake api.github.com: main's head, a compare per old commit, the latest workflow runs.""" + path = request.url.path + if path.endswith("/commits/main"): + return httpx.Response(200, json={"sha": MAIN, "html_url": "https://github.com/x/commit/abc"}) + if "/compare/" in path: + old = path.split("/compare/")[1].split("...")[0] + files = {"0ld0ld0ld0ld": ["services/order/application/saga.py"], # order changed since + "5ame5ame5ame": ["README.md", "services/order/run.py"]}[old] # nothing of payment's + return httpx.Response(200, json={"files": [{"filename": f} for f in files]}) + workflow = path.split("/workflows/")[1].split("/")[0] + return httpx.Response(200, json={"workflow_runs": [{ + "status": "completed", "conclusion": "success", "head_sha": MAIN, + "html_url": f"https://github.com/{REPO}/actions/runs/{workflow}", "created_at": "2026-11-15T20:00:00Z"}]}) @pytest.fixture(autouse=True) -def _stub(monkeypatch): +def _fake_github_and_services(monkeypatch): delivery._cache.clear() + monkeypatch.setattr(delivery, "TRANSPORT", httpx.MockTransport(github_reply)) - async def runtime(request): + async def runtimes(request): return [ {"service": "gateway", "instance": "gateway", "git_sha": "abc123def456"}, {"service": "order", "instance": "order-1", "git_sha": "0ld0ld0ld0ld"}, + {"service": "payment", "instance": "payment-1", "git_sha": "5ame5ame5ame"}, {"service": "user", "instance": "user-5101", "git_sha": "local"}, - {"service": "payment", "instance": "payment-1", "unreachable": True}, + {"service": "catalog", "instance": "catalog-1", "unreachable": True}, ] - async def github(path): - if path.endswith("/commits/main"): - return {"sha": MAIN, "html_url": "https://github.com/x/commit/abc"} - return {"workflow_runs": [{"status": "completed", "conclusion": "success", "head_sha": MAIN, - "html_url": f"https://github.com/x/runs/{path.split('/')[-2]}", - "created_at": "2026-11-15T20:00:00Z"}]} + monkeypatch.setattr(delivery, "collect_runtimes", runtimes) - monkeypatch.setattr(delivery, "process_runtimes", runtime) - monkeypatch.setattr(delivery, "github_get", github) - -def test_each_service_is_marked_current_behind_local_or_unknown(): - body = client.get("/api/patterns/delivery").json() - status = {s["instance"]: s["status"] for s in body["services"]} - assert status == {"gateway": "current", "order-1": "behind", "user-5101": "local", "payment-1": "unknown"} - assert body["main"]["short"] == MAIN[:12] +def test_behind_means_what_deploy_means(): + """Deploy rebuilds only services whose code changed, so the page must not call the rest 'behind'.""" + status = {s["instance"]: s["status"] for s in client.get("/api/patterns/delivery").json()["services"]} + assert status == {"gateway": "current", "order-1": "behind", "payment-1": "unchanged", + "user-5101": "local", "catalog-1": "unknown"} def test_latest_ci_and_deploy_runs_are_linked(): runs = client.get("/api/patterns/delivery").json()["runs"] - assert runs["ci"]["conclusion"] == "success" and runs["ci"]["url"].endswith("ci.yml") - assert runs["deploy"]["url"].endswith("deploy.yml") + assert runs["ci"]["conclusion"] == "success" and runs["ci"]["url"].endswith("/runs/ci.yml") + assert runs["deploy"]["url"].endswith("/runs/deploy.yml") + + +def test_github_answers_are_reused_for_five_minutes(monkeypatch): + calls = [] + monkeypatch.setattr(delivery, "TRANSPORT", httpx.MockTransport(lambda r: calls.append(r) or github_reply(r))) + client.get("/api/patterns/delivery") + first = len(calls) + client.get("/api/patterns/delivery") + assert len(calls) == first + + +def test_after_five_minutes_an_unchanged_answer_costs_no_rate_limit(monkeypatch): + """GitHub does not count a 304 Not Modified against the 60-per-hour limit.""" + seen = [] + + def reply(request): + seen.append(request.headers.get("if-none-match")) + if request.headers.get("if-none-match") == '"v1"': + return httpx.Response(304) + return httpx.Response(200, json={"sha": MAIN, "html_url": "u"}, headers={"ETag": '"v1"'}) + + monkeypatch.setattr(delivery, "TRANSPORT", httpx.MockTransport(reply)) + assert asyncio.run(delivery.github_get("/x"))["sha"] == MAIN + delivery._cache["/x"]["fetched_at"] -= delivery.CACHE_SECONDS + 1 + assert asyncio.run(delivery.github_get("/x"))["sha"] == MAIN + assert seen == [None, '"v1"'] + +def test_a_rate_limited_github_keeps_the_last_good_answer(monkeypatch): + monkeypatch.setattr(delivery, "TRANSPORT", httpx.MockTransport(github_reply)) + assert asyncio.run(delivery.github_get(f"/repos/{REPO}/commits/main"))["sha"] == MAIN + delivery._cache[f"/repos/{REPO}/commits/main"]["fetched_at"] -= delivery.CACHE_SECONDS + 1 + monkeypatch.setattr(delivery, "TRANSPORT", httpx.MockTransport(lambda r: httpx.Response(403))) + assert asyncio.run(delivery.github_get(f"/repos/{REPO}/commits/main"))["sha"] == MAIN -def test_github_unreachable_still_shows_the_services(monkeypatch): - async def down(path): - return None - monkeypatch.setattr(delivery, "github_get", down) - body = client.get("/api/patterns/delivery").json() - assert body["main"] is None and body["runs"] == {"ci": None, "deploy": None} - assert {s["status"] for s in body["services"]} <= {"unknown", "local"} +def test_github_down_or_odd_still_shows_the_services(monkeypatch): + for transport in [httpx.MockTransport(lambda r: httpx.Response(503)), + httpx.MockTransport(lambda r: httpx.Response(200, json={"unexpected": True})), + httpx.MockTransport(lambda r: httpx.Response(200, text="not json"))]: + delivery._cache.clear() + monkeypatch.setattr(delivery, "TRANSPORT", transport) + r = client.get("/api/patterns/delivery") + assert r.status_code == 200 + body = r.json() + assert body["main"] is None and body["runs"] == {"ci": None, "deploy": None} + assert {s["status"] for s in body["services"]} <= {"unknown", "local"}