-
Notifications
You must be signed in to change notification settings - Fork 39
57 lines (47 loc) · 1.19 KB
/
rbac-gen.yml
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
name: RBAC validation
on:
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
rbac-check:
runs-on: ubuntu-latest
strategy:
matrix:
go:
- '1.22'
name: Generate role permissions
steps:
- name: Checkout backplane
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go - ${{ matrix.go }}
uses: actions/setup-go@v2
id: go
with:
go-version: ${{ matrix.go }}
- name: Verify modules
run: |
go mod verify
- name: Verify format
run: |
make fmt
git diff --exit-code
- name: Set up controller-gen
run: |
go install sigs.k8s.io/controller-tools/cmd/[email protected]
- name: Generate RBAC file
run: |
go generate
- name: Regenerate role
run: |
controller-gen rbac:roleName=multicluster-engine-operator-role paths="./..."
- name: Check if files have changed
run: |
git diff
FILES_CHANGED=$(git diff --name-only | wc -l)
if [ "$FILES_CHANGED" != "0" ]; then echo "Remember to run go generate to update rbac"; exit 1; fi;