Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit eb74d76

Browse files
committed
Downgrade controller-gen to v0.7.0
In commit ea79796 ("update to operator-sdk 1.3.0 (#848)"), we upgraded controller-gen to 0.8.0. However, v0.8.0 requires go 1.17 or greater, which is currently unavailable in Red Hat's container registries (i.e. there's no container on catalog.redhat.com); consequently, SBO is built with go 1.16. Until that is rectified, downgrade controller-gen to 0.7.0, which builds with go 1.16. At the same time, we should be using `go install` instead of the now deprecated `go get` when we install tools. There are still a few tools that require `go get`, but for those that don't, we should use the new installation method. This requires a version bump of kustomize to work. Signed-off-by: Andy Sadler <[email protected]>
1 parent 5060f43 commit eb74d76

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

hack/common.mk

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,25 @@ gen-mocks: mockgen
8888
# Download controller-gen locally if necessary
8989
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
9090
controller-gen:
91-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0)
91+
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0)
9292

9393
# Download kustomize locally if necessary
9494
KUSTOMIZE = $(shell pwd)/bin/kustomize
9595
kustomize:
96-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
96+
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
97+
98+
# go-install-tool will 'go install' any package $2 and install it to $1.
99+
define go-install-tool
100+
@[ -f $(1) ] || { \
101+
set -e ;\
102+
TMP_DIR=$$(mktemp -d) ;\
103+
cd $$TMP_DIR ;\
104+
go mod init tmp ;\
105+
echo "Downloading $(2)" ;\
106+
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
107+
rm -rf $$TMP_DIR ;\
108+
}
109+
endef
97110

98111
# go-get-tool will 'go get' any package $2 and install it to $1.
99112
define go-get-tool
@@ -110,7 +123,7 @@ endef
110123

111124
YQ = $(shell pwd)/bin/yq
112125
yq:
113-
$(call go-get-tool,$(YQ),github.com/mikefarah/yq/[email protected])
126+
$(call go-install-tool,$(YQ),github.com/mikefarah/yq/[email protected])
114127

115128
KUBECTL_SLICE = $(shell pwd)/bin/kubectl-slice
116129
kubectl-slice:
@@ -136,4 +149,4 @@ OPM = $(shell which opm)
136149
endif
137150
endif
138151

139-
all: build
152+
all: build

0 commit comments

Comments
 (0)