Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force a check on controller-gen version #2902

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ cni-plugin-lint:
cd control-plane/cni; golangci-lint run -c ../../.golangci.yml

ctrl-generate: get-controller-gen ## Run CRD code generation.
make ensure-controller-gen-version
cd control-plane; $(CONTROLLER_GEN) object paths="./..."

# Perform a terraform fmt check but don't change anything
Expand Down Expand Up @@ -171,6 +172,7 @@ lint: cni-plugin-lint ## Run linter in the control-plane, cli, and acceptance di
for p in control-plane cli acceptance; do cd $$p; golangci-lint run --path-prefix $$p -c ../.golangci.yml; cd ..; done

ctrl-manifests: get-controller-gen ## Generate CRD manifests.
make ensure-controller-gen-version
cd control-plane; $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
make copy-crds-to-chart
make generate-external-crds
Expand All @@ -191,6 +193,15 @@ else
CONTROLLER_GEN=$(shell which controller-gen)
endif

ensure-controller-gen-version: ## Ensure controller-gen version is v0.8.0.
ifeq (, $(shell $(CONTROLLER_GEN) --version | grep v0.8.0))
@echo "controller-gen version is not v0.8.0, uninstall the binary and install the correct version with 'make get-controller-gen'."
@echo "Found version: $(shell $(CONTROLLER_GEN) --version)"
@exit 1
else
@echo "Found correct version: $(shell $(CONTROLLER_GEN) --version)"
endif

add-copyright-header: ## Add copyright header to all files in the project
ifeq (, $(shell which copywrite))
@echo "Installing copywrite"
Expand Down