Skip to content

Merge pull request #34 from fluxcd/dependabot/github_actions/ci-f3717… #50

Merge pull request #34 from fluxcd/dependabot/github_actions/ci-f3717…

Merge pull request #34 from fluxcd/dependabot/github_actions/ci-f3717… #50

name: validate-catalog
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: cmd/validate/go.mod
cache-dependency-path: cmd/validate/go.sum
- name: Validate schemas
run: make validate
- name: Validate catalog consistency
run: |
failed=0
# Every plugin file must have a corresponding catalog entry
for file in plugins/*.yaml; do
name=$(basename "$file" .yaml)
entry=$(yq ".plugins[] | select(.name == \"$name\")" catalog.yaml)
if [ -z "$entry" ]; then
echo "ERROR: plugin '$name' not found in catalog.yaml"
failed=1
fi
done
# Every catalog entry must have a corresponding plugin file
count=$(yq '.plugins | length' catalog.yaml)
for ((i=0; i<count; i++)); do
name=$(yq ".plugins[$i].name" catalog.yaml)
if [ ! -f "plugins/${name}.yaml" ]; then
echo "ERROR: catalog entry '$name' has no matching plugins/${name}.yaml"
failed=1
fi
# Name must not collide with builtins
for reserved in bootstrap build catalog check completion create debug delete diff envsubst events export get help install list logs migrate plugin pull push reconcile resume stats suspend tag trace tree uninstall version; do
if [ "$name" = "$reserved" ]; then
echo "ERROR: catalog entry '$name' collides with built-in command"
failed=1
fi
done
done
if [ "$failed" -ne 0 ]; then
exit 1
fi
echo "Catalog consistency check passed"