Files
homelab/.gitea/workflows/validate.yml
T

53 lines
1.3 KiB
YAML

name: validate
on:
push:
branches:
- "**"
pull_request:
workflow_dispatch:
jobs:
yaml:
runs-on: [self-hosted, linux, arch, homelab]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install yamllint
run: python -m pip install --disable-pip-version-check --no-cache-dir yamllint
- name: Lint YAML syntax
shell: bash
run: |
git ls-files -z '*.yml' '*.yaml' \
| xargs -0 -r yamllint -c .yamllint
k8s:
runs-on: [self-hosted, linux, arch, homelab]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate Kubernetes manifests
shell: bash
run: |
mapfile -t manifests < <(
git ls-files '*k8s/*.yaml' '*k8s/*.yml' \
| grep -Ev '(^|/)(kustomization\.ya?ml|.*\.example\.ya?ml|.*values\.ya?ml|patch-.*\.ya?ml)$'
)
if [ "${#manifests[@]}" -eq 0 ]; then
echo "No Kubernetes manifests found."
exit 0
fi
docker run --rm \
-v "$PWD:/work" \
-w /work \
ghcr.io/yannh/kubeconform:latest \
-strict \
-ignore-missing-schemas \
-summary \
"${manifests[@]}"