Skip to content

Commit

Permalink
Update controller-gen version to 0.14.0 and update makefile
Browse files Browse the repository at this point in the history
Go1.22 broke controller-gen version 0.8.0 through 0.13.0.
Go1.22 drops support for GO111MODULE=off go get -u in legacy gopath
mode.
  • Loading branch information
thunderboltsid committed Mar 13, 2024
1 parent 3e2240b commit d9bf60a
Show file tree
Hide file tree
Showing 6 changed files with 489 additions and 418 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,6 @@ coverage.xml
clusterctl.yaml
cluster.yaml
*.workload.kubeconfig

junit-report.xml

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash
GOCMD=go
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOINSTALL=$(GOCMD) install
GOTOOL=$(GOCMD) tool
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
# Image URL to use all building/pushing image targets
Expand Down Expand Up @@ -81,7 +81,7 @@ SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest

CONTROLLER_GEN_VER := v0.8.0
CONTROLLER_GEN_VER := v0.14.0
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER))
CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen
Expand Down Expand Up @@ -372,7 +372,7 @@ prepare-local-clusterctl: manifests kustomize cluster-templates envsubst ## Prep
.PHONY: unit-test
unit-test: setup-envtest ## Run unit tests.
ifeq ($(EXPORT_RESULT), true)
GO111MODULE=off $(GOGET) -u github.com/jstemmer/go-junit-report
$(GOINSTALL) github.com/jstemmer/go-junit-report/v2@latest
$(eval OUTPUT_OPTIONS = | go-junit-report -set-exit-code > junit-report.xml)
endif
KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) ./... $(OUTPUT_OPTIONS)
Expand All @@ -382,8 +382,8 @@ coverage: setup-envtest ## Run the tests of the project and export the coverage
KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) -cover -covermode=count -coverprofile=profile.cov -coverpkg=./... ./...
$(GOTOOL) cover -func profile.cov
ifeq ($(EXPORT_RESULT), true)
GO111MODULE=off $(GOGET) -u github.com/AlekSi/gocov-xml
GO111MODULE=off $(GOGET) -u github.com/axw/gocov/gocov
$(GOINSTALL) github.com/AlekSi/gocov-xml@latest
$(GOINSTALL) github.com/axw/gocov/gocov@latest
gocov convert profile.cov | gocov-xml > coverage.xml
endif

Expand Down
Loading

0 comments on commit d9bf60a

Please sign in to comment.