generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 2.2 KB
/
kubeconform.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Kubeconform"
on:
pull_request:
branches: ["main"]
paths:
- "kubernetes/**"
env:
SCHEMA_DIR: /home/runner/crds
jobs:
changed-clusters:
name: Changed Clusters
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-clusters.outputs.all_changed_and_modified_files }}
steps:
- name: Checkout Default Branch
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
fetch-depth: 0
- name: Get Changed Clusters
id: changed-clusters
uses: tj-actions/changed-files@d6babd6899969df1a11d14c368283ea4436bca78 # v44
with:
files: kubernetes/**
dir_names: true
dir_names_max_depth: 2
matrix: true
- name: List All Changed Clusters
run: echo "${{ steps.changed-clusters.outputs.all_changed_and_modified_files }}"
kubeconform:
name: Kubeconform
runs-on: ubuntu-latest
needs: ["changed-clusters"]
strategy:
matrix:
paths: ${{ fromJSON(needs.changed-clusters.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Setup Tools
shell: bash
run: brew install kubeconform kustomize
- name: Setup QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Extract files from container image
shell: bash
run: |
mkdir -p ${{ env.SCHEMA_DIR }}
docker run --rm \
-v ${{ env.SCHEMA_DIR }}:/crds \
-u $(id -u) \
--entrypoint /bin/sh \
ghcr.io/martinohmann/kubernetes-schemas:latest \
-c "cp -r /usr/share/nginx/html/* /crds"
- name: Run kubeconform
shell: bash
run: bash ./.github/scripts/kubeconform.sh ${{ matrix.paths }} ${{ env.SCHEMA_DIR }}