Files
test-alex-gitops-1/.gitea/actions/platform-check/action.yml
Scaffolder d10e2ce029
All checks were successful
Build and Push to ACR / Build and Push (push) Successful in 1m43s
initial commit
Change-Id: I3184ea3bc23ecc769c9de5fad0a0a0229e353629
2026-03-23 23:19:03 +00:00

79 lines
3.1 KiB
YAML

name: 'platform-check'
description: 'Validates catalog-info.yaml conformance and platform branch initialization'
runs:
using: composite
steps:
- name: Ensure PyYAML
shell: bash
run: python3 -c "import yaml" 2>/dev/null || pip3 install pyyaml -q
- name: Platform conformance check
shell: bash
run: |
FAIL=0
echo "══════════════════════════════════════════════════"
echo " Platform Conformance Check"
echo "══════════════════════════════════════════════════"
# ── Required platform files ───────────────────────────
for f in catalog-info.yaml Dockerfile docs; do
if [[ -e "$f" ]]; then
echo " ✓ $f"
else
echo " ✗ $f MISSING"
FAIL=1
fi
done
# ── Platform branch model initialization ─────────────────────────────────
if [[ -f ".platform/initialized.md" ]]; then
echo " ✓ .platform/initialized.md (GitOps branch model active)"
else
echo " ✗ .platform/initialized.md MISSING"
echo " This file is committed to the dev branch by gitea:setup-branches."
echo " Its presence proves this PR originated from the platform-managed dev branch."
FAIL=1
fi
# ── catalog-info.yaml field validation ───────────────
if python3 - <<'PYEOF'
import yaml, sys
try:
doc = yaml.safe_load(open('catalog-info.yaml'))
except Exception as e:
print(f" ✗ catalog-info.yaml: parse error: {e}")
sys.exit(1)
fields = [
('apiVersion', lambda d: d.get('apiVersion')),
('kind', lambda d: d.get('kind')),
('metadata.name', lambda d: (d.get('metadata') or {}).get('name')),
('spec.type', lambda d: (d.get('spec') or {}).get('type')),
('spec.owner', lambda d: (d.get('spec') or {}).get('owner')),
]
fail = False
for field, getter in fields:
val = getter(doc)
if val:
print(f" ✓ catalog-info.yaml/{field}: {val}")
else:
print(f" ✗ catalog-info.yaml/{field}: missing or empty")
fail = True
sys.exit(1 if fail else 0)
PYEOF
then
echo " ✓ catalog-info.yaml is conformant"
else
FAIL=1
fi
echo "──────────────────────────────────────────────────"
if [[ $FAIL -eq 0 ]]; then
echo " ✓ Platform conformance: PASSED"
else
echo " ✗ Platform conformance: FAILED"
exit 1
fi