upload
CI/CD (dev on branch, prod on tag) / build-and-deploy (push) Successful in 20m35s

This commit is contained in:
Tom Chien (IQ-AS)
2026-11-18 14:26:36 +08:00
parent 3894a995d7
commit 1988c635fe
34 changed files with 8414 additions and 0 deletions
+139
View File
@@ -0,0 +1,139 @@
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>
);
}
+154
View File
@@ -0,0 +1,154 @@
import type { ReactNode } from "react";
import {
siApple,
siDocker,
siGitea,
siGodaddy,
siHarbor,
siKubernetes,
siNginx,
} from "simple-icons";
import { BarChart3, Globe, Laptop, Rocket } from "lucide-react";
import { BrandIcon } from "@/components/BrandIcon";
import { Boundary, Connector, FlowNode } from "@/components/flow";
type Target = {
name: string;
detail: string;
icon: ReactNode;
accent: string;
};
const targets: Target[] = [
{
name: "it-cost-dev",
detail: "dev environment",
icon: <BarChart3 className="size-5 text-amber-300" aria-hidden="true" />,
accent: "#fcd34d",
},
{
name: "it-cost-prod",
detail: "it-cost-prod.tomchien.com",
icon: <BarChart3 className="size-5 text-emerald-300" aria-hidden="true" />,
accent: "#6ee7b7",
},
{
name: "harbor",
detail: "harbor.tomchien.com",
icon: <BrandIcon icon={siHarbor} className="size-5" />,
accent: `#${siHarbor.hex}`,
},
{
name: "gitea",
detail: "gitea.tomchien.com",
icon: <BrandIcon icon={siGitea} className="size-5" />,
accent: `#${siGitea.hex}`,
},
{
name: "portal",
detail: "tomchien.com · this site",
icon: <Rocket className="size-5 text-sky-300" aria-hidden="true" />,
accent: "#7dd3fc",
},
];
export function RequestFlow() {
return (
<div className="space-y-2">
<Boundary label="Internet" icon={<Globe className="size-3.5" aria-hidden="true" />}>
<div className="flex flex-col items-center lg:flex-row lg:justify-center">
<FlowNode
step={1}
accent="#7dd3fc"
icon={<Laptop className="size-5 text-sky-300" aria-hidden="true" />}
title="Visitor"
subtitle="Opens a hostname in the browser."
detail="*.tomchien.com"
className="w-full lg:max-w-xs"
/>
<Connector label="DNS lookup" />
<FlowNode
step={2}
accent={`#${siGodaddy.hex}`}
icon={<BrandIcon icon={siGodaddy} className="size-5" />}
title="GoDaddy DNS"
subtitle="Records for tomchien.com point every hostname at the lab."
detail="host.tomchien.com → Mac mini"
className="w-full lg:max-w-xs"
/>
</div>
</Boundary>
<div className="flex justify-center">
<Connector vertical label="HTTP :80" />
</div>
<Boundary
label="Mac mini · macOS host"
icon={<BrandIcon icon={siApple} color="#e2e8f0" className="size-3.5" />}
>
<div className="flex flex-col items-stretch lg:flex-row lg:items-center">
<FlowNode
step={3}
accent={`#${siNginx.hex}`}
icon={<BrandIcon icon={siNginx} className="size-5" />}
title="Nginx on the host"
subtitle="Edge reverse proxy: redirects port 80 into the cluster."
detail="listen :80 → 127.0.0.1:8081"
className="lg:max-w-60"
/>
<Connector label=":80 → :8081" />
<Boundary
label="Docker Desktop · Kubernetes"
icon={<BrandIcon icon={siDocker} className="size-3.5" />}
tone="border-sky-400/40"
className="min-w-0 flex-1"
>
<div className="flex flex-col items-stretch lg:flex-row lg:items-center">
<FlowNode
step={4}
accent={`#${siKubernetes.hex}`}
icon={<BrandIcon icon={siKubernetes} className="size-5" />}
title="ingress-nginx"
subtitle="LoadBalancer on 127.0.0.1. Routes by the Host header."
detail="127.0.0.1 : 8081"
className="lg:max-w-56"
/>
<Connector label="Host rule" />
<div className="min-w-0 flex-1">
<p className="mb-2 flex items-center gap-2 text-xs font-medium tracking-wide text-slate-400 uppercase">
<span className="rounded bg-sky-400/15 px-1.5 py-0.5 text-[10px] font-semibold text-sky-300">
5
</span>
Service → Pod
</p>
<ul className="relative space-y-2 border-l border-sky-400/30 pl-4">
{targets.map((t) => (
<li
key={t.name}
className="relative flex items-center gap-3 rounded-lg border border-white/10 bg-slate-900/70 px-3 py-2 before:absolute before:top-1/2 before:-left-4 before:h-px before:w-4 before:bg-sky-400/30"
>
<span
className="flex size-8 flex-none items-center justify-center rounded-md border"
style={{ backgroundColor: `${t.accent}1f`, borderColor: `${t.accent}40` }}
>
{t.icon}
</span>
<span className="min-w-0">
<span className="block text-sm font-semibold text-white">{t.name}</span>
<span className="block truncate font-mono text-[11px] text-slate-400">
{t.detail}
</span>
</span>
</li>
))}
</ul>
</div>
</div>
</Boundary>
</div>
</Boundary>
</div>
);
}
+66
View File
@@ -0,0 +1,66 @@
import type { ReactNode } from "react";
import { siGitea, siHarbor } from "simple-icons";
import { BarChart3, ExternalLink } from "lucide-react";
import { BrandIcon } from "@/components/BrandIcon";
import { CredentialRows } from "@/components/CredentialRows";
import { labServices, type LabService } from "@/content/site";
const visuals: Record<LabService["id"], { icon: ReactNode; accent: string }> = {
"it-cost-prod": {
icon: <BarChart3 className="size-6 text-emerald-300" aria-hidden="true" />,
accent: "#6ee7b7",
},
harbor: {
icon: <BrandIcon icon={siHarbor} className="size-6" />,
accent: `#${siHarbor.hex}`,
},
gitea: {
icon: <BrandIcon icon={siGitea} className="size-6" />,
accent: `#${siGitea.hex}`,
},
};
export function ServiceLinks() {
return (
<ul className="grid gap-4 md:grid-cols-3">
{labServices.map((s) => {
const v = visuals[s.id];
return (
<li
key={s.id}
className="flex flex-col rounded-xl border border-white/10 bg-slate-900/70 p-5 shadow-lg shadow-black/20"
>
<div className="flex items-center gap-3">
<span
className="flex size-12 flex-none items-center justify-center rounded-lg border"
style={{ backgroundColor: `${v.accent}1f`, borderColor: `${v.accent}40` }}
>
{v.icon}
</span>
<div className="min-w-0">
<h4 className="font-semibold text-white">{s.name}</h4>
<p className="flex items-center gap-1.5 text-xs text-emerald-300">
<span className="pulse-ring size-1.5 rounded-full bg-emerald-400" />
{s.id}
</p>
</div>
</div>
<p className="mt-4 text-sm leading-6 text-slate-300">{s.description}</p>
<a
href={s.url}
target="_blank"
rel="noopener noreferrer"
className="mt-4 flex items-center justify-between gap-2 rounded-lg border border-sky-400/30 bg-sky-400/10 px-3 py-2 font-mono text-sm text-sky-200 transition-colors hover:bg-sky-400/20 focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:outline-none"
>
<span className="truncate">{s.host}</span>
<ExternalLink className="size-4 flex-none" aria-hidden="true" />
</a>
<div className="mt-5 border-t border-white/10 pt-4">
<CredentialRows user={s.user} password={s.password} />
</div>
</li>
);
})}
</ul>
);
}
+39
View File
@@ -0,0 +1,39 @@
import {
siApple,
siDocker,
siGitea,
siGodaddy,
siHarbor,
siHelm,
siKubernetes,
siNginx,
} from "simple-icons";
import type { SimpleIcon } from "simple-icons";
import { BrandIcon } from "@/components/BrandIcon";
const stack: { icon: SimpleIcon; label: string; color?: string }[] = [
{ icon: siApple, label: "Mac mini", color: "#e2e8f0" },
{ icon: siDocker, label: "Docker Desktop" },
{ icon: siKubernetes, label: "Kubernetes" },
{ icon: siNginx, label: "Nginx · ingress-nginx" },
{ icon: siGodaddy, label: "GoDaddy DNS" },
{ icon: siGitea, label: "Gitea Actions" },
{ icon: siHarbor, label: "Harbor" },
{ icon: siHelm, label: "Helm", color: "#7c8cff" },
];
export function StackBadges() {
return (
<ul className="flex flex-wrap gap-2">
{stack.map((s) => (
<li
key={s.label}
className="flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-3 py-1.5 text-sm text-slate-200"
>
<BrandIcon icon={s.icon} color={s.color} className="size-4" />
{s.label}
</li>
))}
</ul>
);
}