-
Notifications
You must be signed in to change notification settings - Fork 451
125 lines (105 loc) · 3.37 KB
/
Copy pathoperator-ci.yml
File metadata and controls
125 lines (105 loc) · 3.37 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Operator CI
on:
pull_request:
paths:
- 'kubernetes/operator/**'
- 'kubernetes/helm/operator/**'
- '.github/workflows/operator-ci.yml'
push:
branches:
- main
paths:
- 'kubernetes/operator/**'
- 'kubernetes/helm/operator/**'
jobs:
ci:
name: fmt / vet / lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: kubernetes/operator
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: kubernetes/operator/go.mod
cache-dependency-path: kubernetes/operator/go.sum
- name: go fmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "The following files are not formatted:"
echo "$unformatted"
exit 1
fi
- name: go vet
run: go vet ./...
- name: Install controller-gen
run: GOBIN=$(pwd)/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.4
- name: Check generated manifests are up to date
run: |
./bin/controller-gen rbac:roleName=manager-role crd paths="./..." \
output:crd:artifacts:config=config/crd/bases \
output:rbac:artifacts:config=config/rbac
git diff --exit-code config/
- name: Check generated deepcopy is up to date
run: |
./bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
git diff --exit-code api/
- name: Check generated typed client is up to date
run: |
# Ensure code-generator is available in module cache
go mod download k8s.io/code-generator
make generate-client
git diff --exit-code pkg/generated/
env:
# Suppress verbose output during CI
KUBE_VERBOSE: "0"
- name: go test
run: go test ./... -race -coverprofile=cover.out
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.11.4
working-directory: kubernetes/operator
helm:
name: Helm lint and verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: 'v3.14.0'
- name: Lint Helm chart
run: helm lint kubernetes/helm/operator
- name: Template Helm chart
run: |
helm template openrag-operator kubernetes/helm/operator \
--namespace openrag-control \
--debug
- name: Verify CRD symlink
run: |
if [ ! -L kubernetes/helm/operator/crds/openr.ag_openrags.yaml ]; then
echo "Error: CRD file is not a symlink"
exit 1
fi
echo "CRD symlink verified"
docker:
name: Docker build check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build image (no push)
uses: docker/build-push-action@v6
with:
context: kubernetes/operator
file: kubernetes/operator/Dockerfile
platforms: linux/amd64
push: false
build-args: |
TARGETOS=linux
TARGETARCH=amd64
cache-from: type=gha,scope=operator-amd64
cache-to: type=gha,mode=max,scope=operator-amd64