Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 9e1aab6

Browse files
authored
Merge pull request #412 from ocobleseqx/update_go_install_script
Update go install script and add kustomize install script
2 parents 3a2879b + 2b02c69 commit 9e1aab6

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ GOLANGCI_LINT_BIN := golangci-lint
7979
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
8080

8181
# Keep at 4.0.4 until we figure out how to get later verisons to not mangle the calico yamls
82+
# HACK bump latest version once https://github.com/kubernetes-sigs/kustomize/issues/947 is fixed
8283
KUSTOMIZE_VER := v4.0.4
8384
KUSTOMIZE_BIN := kustomize
8485
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)
@@ -224,8 +225,13 @@ $(ENVSUBST): ## Build envsubst from tools folder.
224225
$(GOLANGCI_LINT): ## Build golangci-lint from tools folder.
225226
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)
226227

227-
$(KUSTOMIZE): ## Build kustomize from tools folder.
228-
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v4 $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)
228+
## HACK replace with $(GO_INSTALL) once https://github.com/kubernetes-sigs/kustomize/issues/947 is fixed
229+
$(KUSTOMIZE): ## Put kustomize into tools folder.
230+
mkdir -p $(TOOLS_BIN_DIR)
231+
rm -f $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)*
232+
curl -fsSL "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- $(KUSTOMIZE_VER:v%=%) $(TOOLS_BIN_DIR)
233+
mv "$(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)" $(KUSTOMIZE)
234+
ln -sf $(KUSTOMIZE) "$(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)"
229235

230236
$(CONTROLLER_GEN): ## Build controller-gen from tools folder.
231237
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/controller-tools/cmd/controller-gen $(CONTROLLER_GEN_BIN) $(CONTROLLER_GEN_VER)

scripts/go_install.sh

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,9 @@ if [ -z "${GOBIN}" ]; then
3737
exit 1
3838
fi
3939

40-
tmp_dir=$(mktemp -d -t goinstall_XXXXXXXXXX)
41-
function clean {
42-
rm -rf "${tmp_dir}"
43-
}
44-
trap clean EXIT
45-
4640
rm "${GOBIN}/${2}"* || true
4741

48-
cd "${tmp_dir}"
49-
50-
# create a new module in the tmp directory
51-
go mod init fake/mod
52-
5342
# install the golang module specified as the first argument
54-
go get -tags tools "${1}@${3}"
43+
go install -tags tools "${1}@${3}"
5544
mv "${GOBIN}/${2}" "${GOBIN}/${2}-${3}"
5645
ln -sf "${GOBIN}/${2}-${3}" "${GOBIN}/${2}"

0 commit comments

Comments
 (0)