Skip to content

Commit

Permalink
.github: add schema validation for files used for matrix generation
Browse files Browse the repository at this point in the history
To prevent developer mistakes we can make use of a schema to perform the
validation of these files.

Suggested-by: Maciej Kwiek <maciej@isovalent.com>
Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed Jun 9, 2023
1 parent 5e84ad6 commit e1c9f34
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/actions/ginkgo/focus-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
focus: list(str())
include: list(include('includeItem'))
exclude: list(include('excludeItem'))
---
includeItem:
focus: str()
cliFocus: str()
cliSkip: str(required=False)
excludeItem:
k8s-version: str()
focus: str()
7 changes: 7 additions & 0 deletions .github/actions/ginkgo/k8s-versions-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include: list(include('includeItem'))
---
includeItem:
k8s-version: str()
ip-family: str()
kube-image: str()
kernel: str()
1 change: 1 addition & 0 deletions .github/actions/ginkgo/prs-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k8s-version: list(str())
1 change: 1 addition & 0 deletions .github/actions/ginkgo/scheduled-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
k8s-version: list(str())
22 changes: 22 additions & 0 deletions .github/workflows/lint-workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,25 @@ jobs:
echo "Please fix the comments from .github/workflows/conformance-runtime.yaml accordingly"
exit 1
fi
ginkgo-schema-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
with:
python-version: '3.10'
- run: pip install yamale
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
persist-credentials: false
# hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
path: src/github.com/cilium/cilium

- name: Validate schema of ginkgo action files
shell: bash
run: |
cd src/github.com/cilium/cilium/.github/actions/ginkgo/
for type in focus k8s-versions prs scheduled; do
yamale -s ${type}-schema.yaml *-${type}.yaml;
done

0 comments on commit e1c9f34

Please sign in to comment.