CI/CD (dev on branch, prod on tag) / build-and-deploy (push) Successful in 20m35s
140 lines
4.8 KiB
TypeScript
140 lines
4.8 KiB
TypeScript
import { siDocker, siGit, siGitea, siHarbor, siHelm, siKubernetes } from "simple-icons";
|
|
import { GitBranch, ShieldCheck, Tag, Undo2 } from "lucide-react";
|
|
import { BrandIcon } from "@/components/BrandIcon";
|
|
import { Connector, FlowNode } from "@/components/flow";
|
|
|
|
const lanes = [
|
|
{
|
|
env: "DEV",
|
|
badge: "border-amber-300/40 bg-amber-300/10 text-amber-200",
|
|
ring: "border-amber-300/25",
|
|
icon: <GitBranch className="size-4 text-amber-300" aria-hidden="true" />,
|
|
trigger: "Push to branch dev",
|
|
rows: [
|
|
["Image tag", "<commit sha> · latest-dev"],
|
|
["Release", "<app>-dev, own namespace"],
|
|
],
|
|
},
|
|
{
|
|
env: "PROD",
|
|
badge: "border-emerald-300/40 bg-emerald-300/10 text-emerald-200",
|
|
ring: "border-emerald-300/25",
|
|
icon: <Tag className="size-4 text-emerald-300" aria-hidden="true" />,
|
|
trigger: "Push a version tag",
|
|
rows: [
|
|
["Guard", "tag commit must be on main"],
|
|
["Image tag", "<release tag> · latest-prod"],
|
|
["Release", "<app>-prod, own namespace"],
|
|
],
|
|
},
|
|
];
|
|
|
|
const guarantees = [
|
|
{ icon: <ShieldCheck className="size-4" aria-hidden="true" />, text: "Immutable image tags" },
|
|
{ icon: <Undo2 className="size-4" aria-hidden="true" />, text: "helm --atomic --wait rolls back a bad release" },
|
|
{ icon: <GitBranch className="size-4" aria-hidden="true" />, text: "One pipeline, two environments" },
|
|
];
|
|
|
|
export function CicdFlow() {
|
|
return (
|
|
<div>
|
|
<div className="flex flex-col items-stretch lg:flex-row lg:items-stretch">
|
|
<FlowNode
|
|
step={1}
|
|
accent={`#${siGit.hex}`}
|
|
icon={<BrandIcon icon={siGit} className="size-5" />}
|
|
title="git push"
|
|
subtitle="A branch or tag push starts the pipeline."
|
|
detail="dev | v1.2.3"
|
|
/>
|
|
<Connector color="#34d399" />
|
|
<FlowNode
|
|
step={2}
|
|
accent={`#${siGitea.hex}`}
|
|
icon={<BrandIcon icon={siGitea} className="size-5" />}
|
|
title="Gitea Actions"
|
|
subtitle="act_runner picks up the workflow from the repo."
|
|
detail="cicd.yaml"
|
|
/>
|
|
<Connector color="#34d399" />
|
|
<FlowNode
|
|
step={3}
|
|
accent={`#${siDocker.hex}`}
|
|
icon={<BrandIcon icon={siDocker} className="size-5" />}
|
|
title="docker build"
|
|
subtitle="Runner pod uses the Docker Desktop daemon socket."
|
|
detail="multi-stage Dockerfile"
|
|
/>
|
|
<Connector color="#34d399" />
|
|
<FlowNode
|
|
step={4}
|
|
accent={`#${siHarbor.hex}`}
|
|
icon={<BrandIcon icon={siHarbor} className="size-5" />}
|
|
title="Harbor"
|
|
subtitle="Image is pushed to the private registry."
|
|
detail="registry :8080"
|
|
/>
|
|
<Connector color="#34d399" />
|
|
<FlowNode
|
|
step={5}
|
|
accent="#7c8cff"
|
|
icon={<BrandIcon icon={siHelm} color="#7c8cff" className="size-5" />}
|
|
title="helm upgrade"
|
|
subtitle="Chart is rolled out to the namespace."
|
|
detail="--atomic"
|
|
/>
|
|
<Connector color="#34d399" />
|
|
<FlowNode
|
|
step={6}
|
|
accent={`#${siKubernetes.hex}`}
|
|
icon={<BrandIcon icon={siKubernetes} className="size-5" />}
|
|
title="Kubernetes"
|
|
subtitle="Pods pull from Harbor with a pull secret."
|
|
detail="Deployment · Service · Ingress"
|
|
/>
|
|
</div>
|
|
|
|
<div className="mt-8 grid gap-4 md:grid-cols-2">
|
|
{lanes.map((lane) => (
|
|
<div
|
|
key={lane.env}
|
|
className={`rounded-xl border bg-slate-900/60 p-5 ${lane.ring}`}
|
|
>
|
|
<div className="flex items-center gap-3">
|
|
<span
|
|
className={`rounded-md border px-2 py-0.5 text-xs font-bold tracking-wider ${lane.badge}`}
|
|
>
|
|
{lane.env}
|
|
</span>
|
|
<span className="flex items-center gap-1.5 text-sm font-medium text-white">
|
|
{lane.icon}
|
|
{lane.trigger}
|
|
</span>
|
|
</div>
|
|
<dl className="mt-4 space-y-2 text-sm">
|
|
{lane.rows.map(([k, v]) => (
|
|
<div key={k} className="flex flex-wrap items-baseline justify-between gap-x-4">
|
|
<dt className="text-slate-400">{k}</dt>
|
|
<dd className="font-mono text-xs text-slate-200">{v}</dd>
|
|
</div>
|
|
))}
|
|
</dl>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
<ul className="mt-6 flex flex-wrap gap-2">
|
|
{guarantees.map((g) => (
|
|
<li
|
|
key={g.text}
|
|
className="flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-3 py-1.5 text-xs text-slate-300"
|
|
>
|
|
<span className="text-emerald-300">{g.icon}</span>
|
|
{g.text}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
);
|
|
}
|