Skip to content

Commit aee2c59

Browse files
committed
fixup! [github workflows] control-operator it's own workflow
1 parent 518bf05 commit aee2c59

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/control-operator.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ jobs:
2323
- uses: actions/setup-go@v2
2424
with:
2525
go-version: ${{matrix.go}}
26+
- uses: arduino/setup-protoc@v3
27+
with:
28+
version: '35.1'
2629
- run: make
2730
- run: make test

control-operator/Makefile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ test: manifests generate fmt vet envtest ## Run tests.
127127
##@ Protobuf
128128

129129
.PHONY: generate-proto
130-
generate-proto: ## Generate protobuf and gRPC Go files from occ.proto.
130+
generate-proto: protoc-gen-go protoc-gen-go-grpc ## Generate protobuf and gRPC Go files from occ.proto.
131131
mkdir -p internal/controller/protos/generated
132-
protoc --go_out=internal/controller/protos/generated --go_opt=paths=source_relative --go-grpc_out=internal/controller/protos/generated --go-grpc_opt=paths=source_relative -I internal/controller/protos internal/controller/protos/occ.proto
132+
PATH="$(LOCALBIN):$$PATH" protoc --go_out=internal/controller/protos/generated --go_opt=paths=source_relative --go-grpc_out=internal/controller/protos/generated --go-grpc_opt=paths=source_relative -I internal/controller/protos internal/controller/protos/occ.proto
133133

134134
.PHONY: clean-proto
135135
clean-proto: ## Remove generated protobuf and gRPC Go files.
@@ -242,10 +242,14 @@ KUBECTL ?= kubectl
242242
KUSTOMIZE ?= $(LOCALBIN)/kustomize
243243
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
244244
ENVTEST ?= $(LOCALBIN)/setup-envtest
245+
PROTOC_GEN_GO ?= $(LOCALBIN)/protoc-gen-go
246+
PROTOC_GEN_GO_GRPC ?= $(LOCALBIN)/protoc-gen-go-grpc
245247

246248
## Tool Versions
247249
KUSTOMIZE_VERSION ?= v5.0.1
248250
CONTROLLER_TOOLS_VERSION ?= v0.16.5
251+
PROTOC_GEN_GO_VERSION ?= v1.36.11
252+
PROTOC_GEN_GO_GRPC_VERSION ?= v1.6.2
249253

250254
.PHONY: kustomize
251255
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
@@ -267,6 +271,18 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
267271
$(ENVTEST): $(LOCALBIN)
268272
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
269273

274+
.PHONY: protoc-gen-go
275+
protoc-gen-go: $(PROTOC_GEN_GO) ## Download protoc-gen-go locally if necessary. If wrong version is installed, it will be overwritten.
276+
$(PROTOC_GEN_GO): $(LOCALBIN)
277+
test -s $(LOCALBIN)/protoc-gen-go && $(LOCALBIN)/protoc-gen-go --version | grep -q $(PROTOC_GEN_GO_VERSION) || \
278+
GOBIN=$(LOCALBIN) go install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
279+
280+
.PHONY: protoc-gen-go-grpc
281+
protoc-gen-go-grpc: $(PROTOC_GEN_GO_GRPC) ## Download protoc-gen-go-grpc locally if necessary. If wrong version is installed, it will be overwritten.
282+
$(PROTOC_GEN_GO_GRPC): $(LOCALBIN)
283+
test -s $(LOCALBIN)/protoc-gen-go-grpc && $(LOCALBIN)/protoc-gen-go-grpc --version | grep -q $(subst v,,$(PROTOC_GEN_GO_GRPC_VERSION)) || \
284+
GOBIN=$(LOCALBIN) go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GEN_GO_GRPC_VERSION)
285+
270286
.PHONY: operator-sdk
271287
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
272288
operator-sdk: ## Download operator-sdk locally if necessary.

0 commit comments

Comments
 (0)