chore: render G14 GitOps desired state

This commit is contained in:
Codex
2026-05-25 01:04:12 +08:00
parent 0b0c02f39c
commit c25b67145d
13 changed files with 2687 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
# HWLAB G14 GitOps CI/CD
This directory is generated from `CI.json`, `deploy/deploy.json`, and `deploy/k8s/*` by `scripts/g14-gitops-render.mjs`.
- Target: G14 k3s only.
- CI: Tekton Pipeline `hwlab-ci/hwlab-g14-ci-image-publish`.
- Artifact contract: images are tagged by source git commit `0b0c02f` and pushed to `127.0.0.1:5000/hwlab`.
- CD: Argo CD Application `argocd/hwlab-g14-dev` consumes `deploy/gitops/g14/runtime`.
- D601 boundary: this path does not target D601, does not use UniDesk Code Queue, and does not change D601 production traffic.
- Concurrency: CI builds are per source commit and do not acquire the legacy DEV CD Lease; Argo CD reconciles the Git desired state.
+34
View File
@@ -0,0 +1,34 @@
{
"apiVersion": "argoproj.io/v1alpha1",
"kind": "Application",
"metadata": {
"name": "hwlab-g14-dev",
"namespace": "argocd",
"labels": {
"app.kubernetes.io/part-of": "hwlab",
"hwlab.pikastech.local/gitops-target": "g14"
}
},
"spec": {
"project": "hwlab-g14",
"source": {
"repoURL": "git@github.com:pikasTech/HWLAB.git",
"targetRevision": "G14",
"path": "deploy/gitops/g14/runtime"
},
"destination": {
"server": "https://kubernetes.default.svc",
"namespace": "hwlab-dev"
},
"syncPolicy": {
"automated": {
"prune": false,
"selfHeal": true
},
"syncOptions": [
"CreateNamespace=true",
"ApplyOutOfSyncOnly=true"
]
}
}
}
+32
View File
@@ -0,0 +1,32 @@
{
"apiVersion": "argoproj.io/v1alpha1",
"kind": "AppProject",
"metadata": {
"name": "hwlab-g14",
"namespace": "argocd"
},
"spec": {
"description": "HWLAB G14 GitOps project; D601 remains outside this project.",
"sourceRepos": [
"git@github.com:pikasTech/HWLAB.git"
],
"destinations": [
{
"server": "https://kubernetes.default.svc",
"namespace": "hwlab-dev"
}
],
"clusterResourceWhitelist": [
{
"group": "",
"kind": "Namespace"
}
],
"namespaceResourceWhitelist": [
{
"group": "*",
"kind": "*"
}
]
}
}
+113
View File
@@ -0,0 +1,113 @@
{
"apiVersion": "v1",
"kind": "List",
"items": [
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "hwlab-ci"
}
},
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "hwlab-registry",
"namespace": "hwlab-ci",
"labels": {
"app.kubernetes.io/name": "hwlab-registry"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/name": "hwlab-registry"
}
},
"template": {
"metadata": {
"labels": {
"app.kubernetes.io/name": "hwlab-registry"
}
},
"spec": {
"hostNetwork": true,
"dnsPolicy": "ClusterFirstWithHostNet",
"containers": [
{
"name": "registry",
"image": "registry:2.8.3",
"imagePullPolicy": "IfNotPresent",
"ports": [
{
"name": "registry",
"containerPort": 5000,
"hostPort": 5000
}
],
"env": [
{
"name": "REGISTRY_STORAGE_DELETE_ENABLED",
"value": "true"
}
],
"volumeMounts": [
{
"name": "storage",
"mountPath": "/var/lib/registry"
}
],
"readinessProbe": {
"httpGet": {
"path": "/v2/",
"port": "registry"
}
},
"livenessProbe": {
"httpGet": {
"path": "/v2/",
"port": "registry"
}
}
}
],
"volumes": [
{
"name": "storage",
"hostPath": {
"path": "/var/lib/hwlab/registry",
"type": "DirectoryOrCreate"
}
}
]
}
}
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-registry",
"namespace": "hwlab-ci",
"labels": {
"app.kubernetes.io/name": "hwlab-registry"
}
},
"spec": {
"selector": {
"app.kubernetes.io/name": "hwlab-registry"
},
"ports": [
{
"name": "registry",
"port": 5000,
"targetPort": "registry"
}
]
}
}
]
}
@@ -0,0 +1,20 @@
{
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"name": "hwlab-code-agent-codex-config",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-code-agent-codex-config",
"hwlab.pikastech.local/service-id": "hwlab-cloud-api",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"data": {
"config.toml": "model_provider = \"OpenAI\"\nmodel = \"gpt-5.4\"\nreview_model = \"gpt-5.4\"\nmodel_reasoning_effort = \"xhigh\"\ndisable_response_storage = true\nnetwork_access = \"enabled\"\nmodel_context_window = 1000000\nmodel_auto_compact_token_limit = 900000\n\n[model_providers.OpenAI]\nname = \"OpenAI\"\nbase_url = \"https://hyueapi.com\"\nwire_api = \"responses\"\nrequires_openai_auth = true\n\n[model_providers.crs]\nrequest_max_retries = 1000\nstream_max_retries = 1000\nname = \"crs\"\nbase_url = \"https://api.gptclubapi.xyz/openai\"\nwire_api = \"responses\"\nrequires_openai_auth = true\nenv_key = \"CRS_OAI_KEY\"\n"
}
}
@@ -0,0 +1,30 @@
{
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"name": "hwlab-dev-health-contract",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-dev-health-contract",
"hwlab.pikastech.local/profile": "dev",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"data": {
"endpoint": "http://hwlab-edge-proxy.hwlab-dev.svc.cluster.local:6667",
"cloud-api": "GET /health/live through http://hwlab-edge-proxy.hwlab-dev.svc.cluster.local:6667",
"cloud-api-db": "DEV DB config gate requires HWLAB_CLOUD_DB_URL from Secret hwlab-cloud-api-dev-db/database-url and HWLAB_CLOUD_DB_SSL_MODE=disable. Runtime readiness dials the redacted host parsed from the Secret URL and reports endpointSource=secret-url-host. cloud-api-db is an optional desired alias only until this repo owns Service plus Endpoint or EndpointSlice manifests and rollout/apply contract; health reports env presence, env injection, redacted connection attempt/result, and liveConnected without exposing secret values",
"cloud-web": "GET /health/live on http://hwlab-cloud-web.hwlab-dev.svc.cluster.local:8080; consumes cloud-api only",
"agent": "hwlab-agent-mgr readiness gates worker template creation; hwlab-agent-worker is suspended until a session is scheduled",
"sim": "hwlab-gateway-simu:7101 and hwlab-box-simu:7201 expose /health/live for DEV smoke",
"patch-panel": "hwlab-patch-panel:7301 exposes /health/live and owns patch panel state",
"router": "hwlab-router:7401 exposes /health/live and owns edge reachability routing",
"tunnel-client": "disabled for G14 GitOps; no FRP or production traffic tunnel is required",
"edge-proxy": "hwlab-edge-proxy:6667 exposes /health/live and proxies DEV endpoint traffic to hwlab-cloud-api",
"runtime-substitute-policy": "Do not replace HWLAB runtime with UniDesk backend, provider-gateway, or microservice proxy"
}
}
@@ -0,0 +1,12 @@
{
"apiVersion": "kustomize.config.k8s.io/v1beta1",
"kind": "Kustomization",
"namespace": "hwlab-dev",
"resources": [
"namespace.yaml",
"code-agent-codex-config.yaml",
"services.yaml",
"health-contract.yaml",
"workloads.yaml"
]
}
+16
View File
@@ -0,0 +1,16 @@
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "hwlab-dev",
"labels": {
"app.kubernetes.io/part-of": "hwlab",
"hwlab.pikastech.local/profile": "dev",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
}
}
+492
View File
@@ -0,0 +1,492 @@
{
"apiVersion": "v1",
"kind": "List",
"items": [
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-cloud-api",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-cloud-api",
"hwlab.pikastech.local/service-id": "hwlab-cloud-api",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-cloud-api"
},
"ports": [
{
"name": "http",
"port": 6667,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-gateway-simu-1",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-gateway-simu",
"hwlab.pikastech.local/service-id": "hwlab-gateway-simu",
"hwlab.pikastech.local/instance-id": "gwsimu_1",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"statefulset.kubernetes.io/pod-name": "hwlab-gateway-simu-0"
},
"ports": [
{
"name": "http",
"port": 7101,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-gateway-simu-2",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-gateway-simu",
"hwlab.pikastech.local/service-id": "hwlab-gateway-simu",
"hwlab.pikastech.local/instance-id": "gwsimu_2",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"statefulset.kubernetes.io/pod-name": "hwlab-gateway-simu-1"
},
"ports": [
{
"name": "http",
"port": 7101,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-cloud-web",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-cloud-web",
"hwlab.pikastech.local/service-id": "hwlab-cloud-web",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-cloud-web"
},
"ports": [
{
"name": "http",
"port": 8080,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-box-simu-1",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-box-simu",
"hwlab.pikastech.local/service-id": "hwlab-box-simu",
"hwlab.pikastech.local/instance-id": "res_boxsimu_1",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"statefulset.kubernetes.io/pod-name": "hwlab-box-simu-0"
},
"ports": [
{
"name": "http",
"port": 7201,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-box-simu-2",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-box-simu",
"hwlab.pikastech.local/service-id": "hwlab-box-simu",
"hwlab.pikastech.local/instance-id": "res_boxsimu_2",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"statefulset.kubernetes.io/pod-name": "hwlab-box-simu-1"
},
"ports": [
{
"name": "http",
"port": 7201,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-gateway",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-gateway",
"hwlab.pikastech.local/service-id": "hwlab-gateway",
"hwlab.pikastech.local/activation": "manual",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-gateway"
},
"ports": [
{
"name": "http",
"port": 7001,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-cli",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-cli",
"hwlab.pikastech.local/service-id": "hwlab-cli",
"hwlab.pikastech.local/activation": "manual",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-cli"
},
"ports": [
{
"name": "http",
"port": 7501,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-agent-skills",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-agent-skills",
"hwlab.pikastech.local/service-id": "hwlab-agent-skills",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-agent-skills"
},
"ports": [
{
"name": "http",
"port": 7430,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-agent-mgr",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-agent-mgr",
"hwlab.pikastech.local/service-id": "hwlab-agent-mgr",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-agent-mgr"
},
"ports": [
{
"name": "http",
"port": 7410,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-gateway-simu",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-gateway-simu",
"hwlab.pikastech.local/service-id": "hwlab-gateway-simu",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-gateway-simu"
},
"ports": [
{
"name": "http",
"port": 7101,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-box-simu",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-box-simu",
"hwlab.pikastech.local/service-id": "hwlab-box-simu",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-box-simu"
},
"ports": [
{
"name": "http",
"port": 7201,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-patch-panel",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-patch-panel",
"hwlab.pikastech.local/service-id": "hwlab-patch-panel",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-patch-panel"
},
"ports": [
{
"name": "http",
"port": 7301,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-router",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-router",
"hwlab.pikastech.local/service-id": "hwlab-router",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-router"
},
"ports": [
{
"name": "http",
"port": 7401,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-tunnel-client",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-tunnel-client",
"hwlab.pikastech.local/service-id": "hwlab-tunnel-client",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-tunnel-client"
},
"ports": [
{
"name": "http",
"port": 7402,
"targetPort": "http"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "hwlab-edge-proxy",
"namespace": "hwlab-dev",
"labels": {
"app.kubernetes.io/name": "hwlab-edge-proxy",
"hwlab.pikastech.local/service-id": "hwlab-edge-proxy",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
"annotations": {
"hwlab.pikastech.local/rendered-by": "scripts/g14-gitops-render.mjs"
}
},
"spec": {
"type": "ClusterIP",
"selector": {
"app.kubernetes.io/name": "hwlab-edge-proxy"
},
"ports": [
{
"name": "http",
"port": 6667,
"targetPort": "http"
}
]
}
}
]
}
File diff suppressed because it is too large Load Diff
+228
View File
@@ -0,0 +1,228 @@
{
"apiVersion": "tekton.dev/v1",
"kind": "Pipeline",
"metadata": {
"name": "hwlab-g14-ci-image-publish",
"namespace": "hwlab-ci",
"labels": {
"app.kubernetes.io/part-of": "hwlab",
"hwlab.pikastech.local/gitops-target": "g14"
},
"annotations": {
"hwlab.pikastech.local/source-config": "CI.json",
"hwlab.pikastech.local/policy": "parallel-no-lock-ci-image-publish"
}
},
"spec": {
"params": [
{
"name": "git-url",
"type": "string",
"default": "git@github.com:pikasTech/HWLAB.git"
},
{
"name": "source-branch",
"type": "string",
"default": "G14"
},
{
"name": "revision",
"type": "string",
"description": "Full git commit SHA; the only source truth for image tags."
},
{
"name": "registry-prefix",
"type": "string",
"default": "127.0.0.1:5000/hwlab"
},
{
"name": "services",
"type": "string",
"default": "hwlab-cloud-api,hwlab-cloud-web,hwlab-agent-mgr,hwlab-agent-worker,hwlab-gateway,hwlab-gateway-simu,hwlab-box-simu,hwlab-patch-panel,hwlab-router,hwlab-tunnel-client,hwlab-edge-proxy,hwlab-cli,hwlab-agent-skills"
},
{
"name": "base-image",
"type": "string",
"default": "node:20-bookworm-slim"
},
{
"name": "concurrency",
"type": "string",
"default": "4"
}
],
"workspaces": [
{
"name": "source"
},
{
"name": "git-ssh"
}
],
"tasks": [
{
"name": "ci-json",
"workspaces": [
{
"name": "source",
"workspace": "source"
},
{
"name": "git-ssh",
"workspace": "git-ssh"
}
],
"taskSpec": {
"params": [
{
"name": "git-url"
},
{
"name": "source-branch"
},
{
"name": "revision"
}
],
"workspaces": [
{
"name": "source"
},
{
"name": "git-ssh"
}
],
"steps": [
{
"name": "ci-json",
"image": "node:22-alpine",
"script": "#!/bin/sh\nset -eu\napk add --no-cache git python3 openssh-client\nmkdir -p /root/.ssh\ncp /workspace/git-ssh/ssh-privatekey /root/.ssh/id_rsa\nchmod 600 /root/.ssh/id_rsa\nssh-keyscan github.com >> /root/.ssh/known_hosts 2>/dev/null\nrm -rf /workspace/source/repo\ngit clone --branch \"$(params.source-branch)\" \"$(params.git-url)\" /workspace/source/repo\ncd /workspace/source/repo\ngit checkout \"$(params.revision)\"\ntest \"$(git rev-parse HEAD)\" = \"$(params.revision)\"\nnpm ci --ignore-scripts\necho 'CI.json hwlab-deploy-skeleton-ci command count=6'\necho 'CI.json command: repo-reports-guard'\nnode scripts/repo-reports-guard.mjs\necho 'CI.json command: contract-check'\nnpm run check\necho 'CI.json command: dev-artifact-publish-static-check'\nnode --check scripts/dev-artifact-publish.mjs\necho 'CI.json command: parse-deploy-json'\nnode -e \"JSON.parse(require('node:fs').readFileSync('deploy/deploy.json','utf8'))\"\necho 'CI.json command: parse-k8s-json-yaml'\nnode -e \"const fs=require('node:fs'); for (const f of fs.readdirSync('deploy/k8s/base').concat(fs.readdirSync('deploy/k8s/dev').map(x=>'../dev/'+x), fs.readdirSync('deploy/k8s/prod').map(x=>'../prod/'+x))) { if (!f.endsWith('.yaml')) continue; const p=f.startsWith('..')?'deploy/k8s/'+f.replace('../',''):'deploy/k8s/base/'+f; JSON.parse(fs.readFileSync(p,'utf8')); }\"\necho 'CI.json command: parse-frp-toml'\npython3 - <<'PY'\nimport pathlib, tomllib\nfor path in pathlib.Path('deploy/frp').glob('*.toml'):\n tomllib.loads(path.read_text())\nPY\n"
}
]
},
"params": [
{
"name": "git-url",
"value": "$(params.git-url)"
},
{
"name": "source-branch",
"value": "$(params.source-branch)"
},
{
"name": "revision",
"value": "$(params.revision)"
}
]
},
{
"name": "image-publish",
"runAfter": [
"ci-json"
],
"workspaces": [
{
"name": "source",
"workspace": "source"
}
],
"taskSpec": {
"params": [
{
"name": "revision"
},
{
"name": "registry-prefix"
},
{
"name": "services"
},
{
"name": "base-image"
},
{
"name": "concurrency"
}
],
"workspaces": [
{
"name": "source"
}
],
"volumes": [
{
"name": "docker-run",
"emptyDir": {}
}
],
"sidecars": [
{
"name": "docker",
"image": "docker:29-dind",
"args": [
"--host=unix:///var/run/docker.sock",
"--storage-driver=vfs"
],
"env": [
{
"name": "DOCKER_TLS_CERTDIR",
"value": ""
}
],
"securityContext": {
"privileged": true
},
"volumeMounts": [
{
"name": "docker-run",
"mountPath": "/var/run"
}
]
}
],
"steps": [
{
"name": "publish",
"image": "node:22-alpine",
"env": [
{
"name": "DOCKER_HOST",
"value": "unix:///var/run/docker.sock"
}
],
"volumeMounts": [
{
"name": "docker-run",
"mountPath": "/var/run"
}
],
"script": "#!/bin/sh\nset -eu\napk add --no-cache docker-cli git openssh-client python3\nexport DOCKER_HOST=unix:///var/run/docker.sock\nexport HWLAB_CI_ARTIFACT_RUN_ID=\"$(context.pipelineRun.name)\"\nexport HWLAB_CI_ARTIFACT_RUN_OWNER=\"tekton\"\nexport HWLAB_DEV_REGISTRY_PREFIX=\"$(params.registry-prefix)\"\nexport HWLAB_DEV_REGISTRY_K8S_NATIVE=1\nif [ -n \"$(params.base-image)\" ]; then export HWLAB_DEV_BASE_IMAGE=\"$(params.base-image)\"; fi\nfor i in $(seq 1 90); do docker info >/dev/null 2>&1 && break; sleep 2; done\ndocker info >/dev/null\ncd /workspace/source/repo\ntest \"$(git rev-parse HEAD)\" = \"$(params.revision)\"\nnode scripts/dev-artifact-publish.mjs --publish --registry-prefix \"$(params.registry-prefix)\" --report /workspace/source/dev-artifacts.json --quiet-build --concurrency \"$(params.concurrency)\" --services \"$(params.services)\"\nnode scripts/refresh-artifact-catalog.mjs --target-ref HEAD --publish-report /workspace/source/dev-artifacts.json --no-write\n"
}
]
},
"params": [
{
"name": "revision",
"value": "$(params.revision)"
},
{
"name": "registry-prefix",
"value": "$(params.registry-prefix)"
},
{
"name": "services",
"value": "$(params.services)"
},
{
"name": "base-image",
"value": "$(params.base-image)"
},
{
"name": "concurrency",
"value": "$(params.concurrency)"
}
]
}
]
}
}
@@ -0,0 +1,74 @@
{
"apiVersion": "tekton.dev/v1",
"kind": "PipelineRun",
"metadata": {
"generateName": "hwlab-g14-ci-",
"namespace": "hwlab-ci",
"labels": {
"app.kubernetes.io/part-of": "hwlab",
"hwlab.pikastech.local/gitops-target": "g14",
"hwlab.pikastech.local/source-commit": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
}
},
"spec": {
"pipelineRef": {
"name": "hwlab-g14-ci-image-publish"
},
"taskRunTemplate": {
"serviceAccountName": "hwlab-tekton-runner",
"podTemplate": {
"hostNetwork": true,
"dnsPolicy": "ClusterFirstWithHostNet"
}
},
"params": [
{
"name": "git-url",
"value": "git@github.com:pikasTech/HWLAB.git"
},
{
"name": "source-branch",
"value": "G14"
},
{
"name": "revision",
"value": "0b0c02f39c6a55797a5a1d807e06d5ccd8621e3b"
},
{
"name": "registry-prefix",
"value": "127.0.0.1:5000/hwlab"
},
{
"name": "base-image",
"value": "node:20-bookworm-slim"
},
{
"name": "concurrency",
"value": "4"
}
],
"workspaces": [
{
"name": "source",
"volumeClaimTemplate": {
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "8Gi"
}
}
}
}
},
{
"name": "git-ssh",
"secret": {
"secretName": "hwlab-git-ssh"
}
}
]
}
}
+93
View File
@@ -0,0 +1,93 @@
{
"apiVersion": "v1",
"kind": "List",
"items": [
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "hwlab-ci"
}
},
{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": {
"name": "hwlab-tekton-runner",
"namespace": "hwlab-ci"
}
},
{
"apiVersion": "rbac.authorization.k8s.io/v1",
"kind": "Role",
"metadata": {
"name": "hwlab-tekton-runtime-observer",
"namespace": "hwlab-dev"
},
"rules": [
{
"apiGroups": [
""
],
"resources": [
"pods",
"services",
"configmaps"
],
"verbs": [
"get",
"list",
"watch"
]
},
{
"apiGroups": [
"apps"
],
"resources": [
"deployments",
"statefulsets"
],
"verbs": [
"get",
"list",
"watch"
]
},
{
"apiGroups": [
"batch"
],
"resources": [
"jobs"
],
"verbs": [
"get",
"list",
"watch"
]
}
]
},
{
"apiVersion": "rbac.authorization.k8s.io/v1",
"kind": "RoleBinding",
"metadata": {
"name": "hwlab-tekton-runtime-observer",
"namespace": "hwlab-dev"
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "hwlab-tekton-runner",
"namespace": "hwlab-ci"
}
],
"roleRef": {
"apiGroup": "rbac.authorization.k8s.io",
"kind": "Role",
"name": "hwlab-tekton-runtime-observer"
}
}
]
}