Skip to content

Check_manifests

FieldValue
TypeSkill Resource
Source~/.copilot/skills/platform/scripts/check_manifests.sh
DescriptionNot specified

Source Content

#!/usr/bin/env bash
# Check raw Kubernetes manifests: schema-valid, no floating `latest` image
# tag, and every container declares resource requests/limits.
#
# Usage: check_manifests.sh <manifests-dir-or-file>
set -uo pipefail
TARGET="${1:-.}"
fail=0
files=$(find "$TARGET" -name '*.yaml' -o -name '*.yml' 2>/dev/null)
if [[ -z "$files" ]]; then
echo "⚠️ no manifest files found under $TARGET"
exit 0
fi
if command -v kubeconform >/dev/null 2>&1; then
if cat $files | kubeconform -strict -summary -ignore-missing-schemas; then
echo "✅ kubeconform -strict clean"
else
echo "❌ kubeconform found schema violations"
fail=1
fi
else
echo "⚠️ kubeconform not on PATH — skipped schema check"
fi
if grep -rniE 'image:\s*.*:latest' $files 2>/dev/null; then
echo "❌ found an image pinned to :latest — use a pinned digest or version tag"
fail=1
else
echo "✅ no :latest image tags found"
fi
for f in $files; do
if grep -q '^kind:\s*Deployment\|^kind:\s*StatefulSet' "$f" 2>/dev/null || grep -qE '^\s*kind:\s*(Deployment|StatefulSet)' "$f"; then
if grep -q 'resources:' "$f"; then
echo "$f: declares resources"
else
echo "$f: Deployment/StatefulSet with no resources: block — set requests/limits"
fail=1
fi
fi
done
exit "$fail"