Skip to content

Commit 2647f1d

Browse files
Clean up Makefile:
Remove unused goals/targets and associated files and directories. Signed-off-by: Jacob Weinstock <[email protected]>
1 parent 9f26874 commit 2647f1d

24 files changed

+22
-778
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.github
22
.vscode
33
config/
4-
hack/
54
docs/
65
templates/
76
scripts/

.github/workflows/ci.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,12 @@ jobs:
3131

3232
- uses: actions/cache@v4
3333
with:
34-
path: hack/tools/bin
34+
path: bin
3535
key: ${{ runner.os }}-tools-bin-${{ matrix.target }}-${{ hashFiles('Makefile') }}
3636
restore-keys: |
3737
${{ runner.os }}-tools-bin-${{ matrix.target }}-
3838
${{ runner.os }}-tools-bin-
3939
40-
- uses: actions/cache@v4
41-
if: ${{ matrix.target == 'test' }}
42-
with:
43-
path: /tmp/kubebuilder-tools-*.tar.gz
44-
key: ${{ runner.os }}-tmp-${{ matrix.target }}-${{ hashFiles('scripts/fetch_ext_bins.sh') }}
45-
restore-keys: |
46-
${{ runner.os }}-tmp-${{ matrix.target }}-
47-
${{ runner.os }}-tmp-
48-
4940
- name: ${{ matrix.target }}
5041
run: make ${{ matrix.target }}
5142

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989

9090
- uses: actions/cache@v4
9191
with:
92-
path: hack/tools/bin
92+
path: bin
9393
key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }}
9494
restore-keys: |
9595
${{ runner.os }}-tools-bin-release-

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@ dist
4343

4444
# development / test / lints
4545
bin/
46-
hack/tools

Makefile

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ GOPROXY := https://proxy.golang.org
2929
endif
3030
export GOPROXY
3131

32-
# Active module mode, as we use go modules to manage dependencies
33-
export GO111MODULE=on
34-
3532
# Default timeout for starting/stopping the Kubebuilder test control plane
3633
export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?=60s
3734
export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?=60s
@@ -42,11 +39,7 @@ export DOCKER_CLI_EXPERIMENTAL := enabled
4239
CURL_RETRIES=3
4340

4441
# Directories.
45-
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
46-
TOOLS_DIR := hack/tools
47-
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)
48-
BIN_DIR := $(abspath $(ROOT_DIR)/bin)
49-
GO_INSTALL = ./scripts/go_install.sh
42+
TOOLS_BIN_DIR := $(abspath bin)
5043

5144
# Binaries.
5245
CONTROLLER_GEN := go run sigs.k8s.io/controller-tools/cmd/[email protected]
@@ -55,28 +48,16 @@ GOLANGCI_LINT_VER := v2.3.0
5548
GOLANGCI_LINT_BIN := golangci-lint
5649
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
5750

51+
KUSTOMIZE_VER := v5.7.1
5852
KUSTOMIZE_BIN := kustomize
59-
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)
60-
61-
KUBECTL_VER := v1.33.0
62-
KUBECTL_BIN := kubectl
63-
KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER)
64-
65-
KIND_VER := v0.29.0
66-
KIND_BIN := kind
67-
KIND := $(TOOLS_BIN_DIR)/$(KIND_BIN)-$(KIND_VER)
53+
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)
6854

69-
toolsBins := $(addprefix ${TOOLS_BIN_DIR}/,$(notdir $(shell awk -F'"' '/^\s*_/ {print $$2}' tools.go | sed 's|/v[[:digit:]]\+||')))
70-
71-
# installs cli tools defined in tools.go
72-
$(toolsBins): go.mod go.sum tools.go
73-
$(toolsBins): CMD=$(shell grep -w '$(@F)' tools.go | awk -F'"' '{print $$2}')
74-
$(toolsBins):
75-
echo "Installing $(CMD)"
76-
GOBIN=$(TOOLS_BIN_DIR) go install $(CMD)
55+
GINKGO_VER := v2.23.4
56+
GINKGO_BIN := ginkgo
57+
GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)
7758

7859
.PHONY: tools
79-
tools: ${toolsBins} ## Build Go based build tools
60+
tools: $(GINKGO) $(KUSTOMIZE) $(GOLANGCI_LINT) ## Install build tools
8061

8162
TIMEOUT := $(shell command -v timeout || command -v gtimeout)
8263

@@ -122,7 +103,7 @@ help: ## Display this help
122103

123104
.PHONY: test
124105
test: ## Run tests
125-
source ./scripts/fetch_ext_bins.sh; fetch_tools; setup_envs; go test -v ./... -coverprofile cover.out
106+
go test -v ./... -coverprofile cover.out
126107

127108
## --------------------------------------
128109
## Tooling Binaries
@@ -142,6 +123,16 @@ $(KIND): ## Build kind
142123
ln -sf "$(KIND)" "$(TOOLS_BIN_DIR)/$(KIND_BIN)"
143124
chmod +x "$(TOOLS_BIN_DIR)/$(KIND_BIN)" "$(KIND)"
144125

126+
$(GINKGO): ## Build ginkgo
127+
mkdir -p $(TOOLS_BIN_DIR)
128+
GOBIN=$(TOOLS_BIN_DIR) go install github.com/onsi/ginkgo/v2/ginkgo@${GINKGO_VER}
129+
@mv $(TOOLS_BIN_DIR)/ginkgo $(GINKGO)
130+
131+
$(KUSTOMIZE): ## Install kustomize
132+
mkdir -p $(TOOLS_BIN_DIR)
133+
GOBIN=$(TOOLS_BIN_DIR) go install sigs.k8s.io/kustomize/kustomize/v5@${KUSTOMIZE_VER}
134+
@mv $(TOOLS_BIN_DIR)/kustomize $(KUSTOMIZE)
135+
145136
## --------------------------------------
146137
## Linting
147138
## --------------------------------------
@@ -204,7 +195,7 @@ generate: ## Generate code
204195
generate-go: tools ## Runs Go related generate targets
205196
$(CONTROLLER_GEN) \
206197
paths=./api/... \
207-
object:headerFile=./hack/boilerplate.go.txt
198+
object:headerFile=./config/boilerplate.go.txt
208199
go generate ./...
209200

210201
.PHONY: generate-manifests
@@ -314,7 +305,6 @@ clean: clean-bin clean-temporary clean-release ## Remove all generated files
314305
.PHONY: clean-bin
315306
clean-bin: ## Remove all generated binaries
316307
rm -rf bin
317-
rm -rf hack/tools/bin
318308

319309
.PHONY: clean-temporary
320310
clean-temporary: ## Remove all temporary files and folders
@@ -328,13 +318,9 @@ clean-release: ## Remove the release folder
328318
.PHONY: verify
329319
verify: verify-modules verify-gen
330320

331-
.PHONY: verify-boilerplate
332-
verify-boilerplate:
333-
./hack/verify-boilerplate.sh
334-
335321
.PHONY: verify-modules
336322
verify-modules: modules
337-
@if !(git diff --quiet HEAD -- go.sum go.mod hack/tools/go.mod hack/tools/go.sum); then \
323+
@if !(git diff --quiet HEAD -- go.sum go.mod); then \
338324
echo "go module files are out of date"; exit 1; \
339325
fi
340326

File renamed without changes.

hack/boilerplate/boilerplate.Dockerfile.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

hack/boilerplate/boilerplate.Makefile.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

hack/boilerplate/boilerplate.bzl.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

hack/boilerplate/boilerplate.generatebzl.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)