|
7 | 7 | jobs: |
8 | 8 | apply-all-yaml: |
9 | 9 | runs-on: ubuntu-latest |
10 | | - |
11 | | - ## run a single container k8s control plane: |
12 | | - ## couldn't figure how to specify a custom command for the container |
13 | | - ## so ended up creating a custom image |
14 | | - #services: |
15 | | - # k3s: |
16 | | - # image: lalyos/k3s:hack |
17 | | - # ports: |
18 | | - # - 8080:8080 |
19 | | - # options: >- |
20 | | - # --privileged |
21 | | - |
22 | 10 | steps: |
23 | 11 | - uses: actions/checkout@v2 |
24 | | - |
25 | | - # - name: kubectl version |
26 | | - # run: | |
27 | | - # sleep 5 |
28 | | - # type kubectl |
29 | | - # kubectl version || true | tee apply.txt |
30 | | - # ls ~/.* |
31 | | - # kubectl create sa default 2>/dev/null || true |
32 | | - # kubectl get sa -A |
33 | | - |
34 | | - # - name: check all yaml |
35 | | - # run: | |
36 | | - # for y in [A-Z][a-z]*/**/*.yaml; do |
37 | | - # echo === apply: ${y} |
38 | | - # if kubectl apply -f $y ;then |
39 | | - # kubectl delete -f $y & |
40 | | - # else |
41 | | - # echo === ERROR: $y |
42 | | - # fi |
43 | | - # done |& tee apply.txt |
44 | | - |
45 | | - # - name: upload artifact |
46 | | - # uses: actions/upload-artifact@v2 |
47 | | - # with: |
48 | | - # name: apply-test-all-yaml |
49 | | - # path: apply.txt |
50 | | - |
51 | | - # - name: check apply log for error |
52 | | - # run: | |
53 | | - # if grep -B1 '=== ERROR' apply.txt; then exit 1; fi |
| 12 | + - name: install kubeval |
| 13 | + run: | |
| 14 | + curl -L https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz | tar -zxf - |
| 15 | + sudo mv kubeval /usr/local/bin |
| 16 | + - name: check all yaml |
| 17 | + run: | |
| 18 | + comm -3 <(find . | grep yaml$ | sort) <(cat .kubeval-ignore | sort) | xargs -n1 kubeval | tee -a apply.txt |
| 19 | + - name: upload artifact |
| 20 | + uses: actions/upload-artifact@v2 |
| 21 | + with: |
| 22 | + name: apply-test-all-yaml |
| 23 | + path: apply.txt |
| 24 | + - name: check apply log for error |
| 25 | + run: | |
| 26 | + if grep '^ERR' apply.txt; then exit 1; fi |
0 commit comments