fix: manifest check in Node (python3 absent on slim runner)
This commit is contained in:
@@ -37,28 +37,18 @@ jobs:
|
||||
- name: Validate Kubernetes manifest
|
||||
run: |
|
||||
# Offline check only: the runner has no cluster. The real apply happens
|
||||
# in the deploy job using the KUBE_CONFIG secret.
|
||||
python3 - <<'PY'
|
||||
import sys, subprocess
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
subprocess.run(["apk", "add", "--no-cache", "py3-yaml"], check=False)
|
||||
import importlib
|
||||
yaml = importlib.import_module("yaml")
|
||||
kinds = []
|
||||
with open("deploy/havenllo.yaml") as f:
|
||||
for doc in yaml.safe_load_all(f):
|
||||
if doc is None:
|
||||
continue
|
||||
kinds.append(doc.get("kind"))
|
||||
required = ["PersistentVolumeClaim", "Deployment", "Service", "Ingress"]
|
||||
missing = [k for k in required if k not in kinds]
|
||||
if missing:
|
||||
print("MISSING KINDS:", missing)
|
||||
sys.exit(1)
|
||||
print("manifest docs OK:", kinds)
|
||||
PY
|
||||
# in the deploy job using the KUBE_CONFIG secret. Node is already
|
||||
# installed in the verify job, so use it (no python on the slim image).
|
||||
node -e '
|
||||
const fs = require("fs");
|
||||
const txt = fs.readFileSync("deploy/havenllo.yaml", "utf8");
|
||||
const docs = txt.split(/\n---\n/).map(s => s.trim()).filter(Boolean);
|
||||
const kinds = docs.map(d => { const m = d.match(/^kind:\s*(\S+)/m); return m ? m[1] : null; });
|
||||
const req = ["PersistentVolumeClaim", "Deployment", "Service", "Ingress"];
|
||||
const miss = req.filter(k => !kinds.includes(k));
|
||||
console.log("docs:", docs.length, "kinds:", kinds.join(", "));
|
||||
if (miss.length) { console.error("MISSING KINDS:", miss.join(", ")); process.exit(1); }
|
||||
'
|
||||
build:
|
||||
name: Build and push image
|
||||
needs: verify
|
||||
|
||||
Reference in New Issue
Block a user