diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2301fd4..6bd6103 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -13,7 +13,7 @@ jobs: kubernetes-version: [ '1.16.0', '1.21.0' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Extract K8s YAML from Markdown files run: sh .test/extract_all_k8s_from_md.sh @@ -34,11 +34,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Extract K8s YAML from Markdown files - run: sh .test/extract_all_k8s_from_md.sh + run: bash .test/extract_all_k8s_from_md.sh - name: Lint Kubernetes Resources - run: sh .test/lint_kubeval.sh - + run: bash .test/lint_kube.sh diff --git a/.test/lint_kube.sh b/.test/lint_kube.sh new file mode 100644 index 0000000..d8926ff --- /dev/null +++ b/.test/lint_kube.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Select all yaml files, except the Helmsman related ones. These are +# detected by exluding files with filenames starting with "helmfile." or "values-". +KUBERNETES_RESOURCE_FILES=$(find * -type f \( -iname '*.yml' -or -iname '*.yaml' \) -and ! \( -iname "helmfile.yaml" -or -iname "values-*.yaml" -or -iname "*docker-compose*" \)) + +excludes=( + deployments-loadbalancing/start/frontend-deployment.yaml + deployments-loadbalancing/start/backend-deployment.yaml + manifests/start/frontend-pod.yaml + services/start/backend-svc.yaml + services/start/frontend-svc.yaml + old/support-files/traefik-rbac-serviceaccount.yaml + old/ingress-nginx/ingress.yml + old/support-files/traefik-service.yaml + old/extras/08-ingress-gke.md.yaml + old/extras/08-ingress-gke.md.yaml + old/extras/08-ingress-traefik.md.yaml + old/support-files/traefik-rbac-serviceaccount.yaml + old/extras/08-ingress-traefik.md.yaml + old/extras/08-ingress-traefik.md.yaml + old/extras/08-ingress-traefik.md.yaml + old/ingress-gke/ingress.yml + old/ingress-traefik/traefik-rbac.yaml + old/ingress-traefik/traefik-rbac.yaml + old/ingress-traefik/traefik-webui-ingress.yaml + old/ingress-traefik/example-ingress.yaml + old/ingress-traefik/my-ingress.yml + old/ingress-traefik/traefik-ingress-controller.yml +) +for exclude in ${excludes[@]} +do + KUBERNETES_RESOURCE_FILES=("${KUBERNETES_RESOURCE_FILES[@]/$exclude}") +done + +# Run all files through kubeconform +docker run --rm -v ${PWD}:/fixtures -w /fixtures ghcr.io/yannh/kubeconform -summary $KUBERNETES_RESOURCE_FILES diff --git a/.test/lint_kubeval.sh b/.test/lint_kubeval.sh deleted file mode 100644 index 3f9c44d..0000000 --- a/.test/lint_kubeval.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Select all yaml files, except the Helmsman related ones. These are -# detected by exluding files with filenames starting with "helmfile." or "values-". -KUBERNETES_RESOURCE_FILES=$(find * -type f \( -iname '*.yml' -or -iname '*.yaml' \) -and ! \( -iname "helmfile.yaml" -or -iname "values-*.yaml" -or -iname "*docker-compose*" \)) - -# Run all files through kubeval -docker run --rm -v `pwd`:/fixtures -w /fixtures garethr/kubeval $KUBERNETES_RESOURCE_FILES -