build: add k8s validation workflow #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Kubernetes Validation | |
on: | |
pull_request: | |
jobs: | |
load-environments: | |
name: Load environments | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: set-matrix | |
run: echo "::set-output name=matrix::$(ls .github/environments/ | jq -R -s -c 'split("\n")[:-1]')" | |
kubeconform-validation: | |
needs: load-environments | |
name: Kubeconform validation | |
strategy: | |
matrix: | |
environment: ${{fromJson(needs.load-environments.outputs.matrix)}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Setup Tutor environment | |
run: | | |
export TUTOR_ROOT=$GITHUB_WORKSPACE/.github/environments/${{ matrix.environment }} | |
export TUTOR_PLUGINS=$TUTOR_ROOT/plugins | |
- name: Install python reqs | |
run: | | |
pip install -r $TUTOR_ROOT/requirements.txt | |
pip install -e . | |
- name: Tutor config save | |
run: tutor config save | |
- name: Install Kubernetes tools | |
uses: alexellis/arkade-get@master | |
with: | |
kubectl: latest | |
kustomize: latest | |
helm: latest | |
kubeconform: latest | |
- name: Check k8s manifests | |
run: | | |
kustomize build $TUTOR_ROOT/env | kubeconform -strict -ignore-missing-schemas -kubernetes-version latest |