Skip to content

Commit 3aa34dc

Browse files
authored
Merge pull request #120 from kcp-dev/uget
Use µget to download build tooling
2 parents 6b75d0a + 28c79d3 commit 3aa34dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+838
-414
lines changed

Makefile

Lines changed: 102 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ GOTOOLFLAGS ?= $(GOBUILDFLAGS) -ldflags '$(LDFLAGS) $(LDFLAGS_EXTRA)' $(GOTOOLFL
3535
GOARCH ?= $(shell go env GOARCH)
3636
GOOS ?= $(shell go env GOOS)
3737

38+
export UGET_DIRECTORY = _tools
39+
export UGET_CHECKSUMS = hack/tools.checksums
40+
export UGET_VERSIONED_BINARIES = true
41+
3842
.PHONY: all
3943
all: build test
4044

@@ -50,88 +54,16 @@ $(CMD): %: $(BUILD_DEST)/%
5054
$(BUILD_DEST)/%: cmd/%
5155
go build $(GOTOOLFLAGS) -o $@ ./cmd/$*
5256

53-
GOLANGCI_LINT = _tools/golangci-lint
54-
GOLANGCI_LINT_VERSION = 2.1.6
55-
56-
.PHONY: $(GOLANGCI_LINT)
57-
$(GOLANGCI_LINT):
58-
@hack/download-tool.sh \
59-
https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-${GOOS}-${GOARCH}.tar.gz \
60-
golangci-lint \
61-
${GOLANGCI_LINT_VERSION}
62-
63-
GIMPS = _tools/gimps
64-
GIMPS_VERSION = 0.6.3
65-
66-
.PHONY: $(GIMPS)
67-
$(GIMPS):
68-
@hack/download-tool.sh \
69-
https://codeberg.org/xrstf/gimps/releases/download/v${GIMPS_VERSION}/gimps_${GIMPS_VERSION}_${GOOS}_${GOARCH}.tar.gz \
70-
gimps \
71-
${GIMPS_VERSION}
72-
73-
# wwhrd is installed as a Go module rather than from the provided
74-
# binaries because there is no arm64 binary available from the author.
75-
# See https://github.com/frapposelli/wwhrd/issues/141
76-
77-
WWHRD = _tools/wwhrd
78-
WWHRD_VERSION = 06b99400ca6db678386ba5dc39bbbdcdadb664ff
79-
80-
.PHONY: $(WWHRD)
81-
$(WWHRD):
82-
@GO_MODULE=true hack/download-tool.sh \
83-
github.com/frapposelli/wwhrd \
84-
wwhrd \
85-
${WWHRD_VERSION}
86-
87-
BOILERPLATE = _tools/boilerplate
88-
BOILERPLATE_VERSION = 0.3.0
89-
90-
.PHONY: $(BOILERPLATE)
91-
$(BOILERPLATE):
92-
@hack/download-tool.sh \
93-
https://github.com/kubermatic-labs/boilerplate/releases/download/v${BOILERPLATE_VERSION}/boilerplate_${BOILERPLATE_VERSION}_${GOOS}_${GOARCH}.tar.gz \
94-
boilerplate \
95-
${BOILERPLATE_VERSION}
96-
97-
YQ = _tools/yq
98-
YQ_VERSION = 4.44.6
99-
100-
.PHONY: $(YQ)
101-
$(YQ):
102-
@UNCOMPRESSED=true hack/download-tool.sh \
103-
https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_${GOOS}_${GOARCH} \
104-
yq \
105-
${YQ_VERSION} \
106-
yq_*
107-
108-
KCP = _tools/kcp
109-
export KCP_VERSION ?= 0.28.1
110-
111-
.PHONY: $(KCP)
112-
$(KCP):
113-
@hack/download-tool.sh \
114-
https://github.com/kcp-dev/kcp/releases/download/v${KCP_VERSION}/kcp_${KCP_VERSION}_${GOOS}_${GOARCH}.tar.gz \
115-
kcp \
116-
${KCP_VERSION}
117-
118-
ENVTEST = _tools/setup-envtest
119-
ENVTEST_VERSION = release-0.19
120-
121-
.PHONY: $(ENVTEST)
122-
$(ENVTEST):
123-
@GO_MODULE=true hack/download-tool.sh sigs.k8s.io/controller-runtime/tools/setup-envtest setup-envtest $(ENVTEST_VERSION)
124-
12557
.PHONY: test
12658
test:
12759
./hack/run-tests.sh
12860

12961
.PHONY: test-e2e
130-
test-e2e: $(ENVTEST) $(KCP)
62+
test-e2e:
13163
./hack/run-e2e-tests.sh
13264

13365
.PHONY: codegen
134-
codegen: $(YQ)
66+
codegen:
13567
hack/update-codegen-crds.sh
13668
hack/update-codegen-sdk.sh
13769

@@ -141,26 +73,118 @@ build-tests:
14173

14274
.PHONY: clean
14375
clean:
144-
rm -rf $(BUILD_DEST)
145-
@echo "Cleaned $(BUILD_DEST)"
76+
rm -rf $(BUILD_DEST) $(UGET_DIRECTORY)
77+
@echo "Cleaned $(BUILD_DEST) and $(UGET_DIRECTORY)"
14678

14779
.PHONY: lint
148-
lint: $(GOLANGCI_LINT)
80+
lint: install-golangci-lint
14981
$(GOLANGCI_LINT) run \
15082
--verbose \
15183
--timeout 20m \
15284
--print-resources-usage \
15385
./...
15486

15587
.PHONY: imports
156-
imports: $(GIMPS)
88+
imports: install-gimps
15789
$(GIMPS) .
15890

15991
.PHONY: verify
16092
verify:
16193
./hack/verify-boilerplate.sh
16294
./hack/verify-licenses.sh
16395

96+
############################################################################
97+
### tools
98+
99+
BOILERPLATE_VERSION ?= 0.3.0
100+
ENVTEST_VERSION ?= release-0.19
101+
GIMPS_VERSION ?= 0.6.3
102+
GOIMPORTS_VERSION ?= c70783e636f2213cac683f6865d88c5edace3157
103+
GOLANGCI_LINT_VERSION ?= 2.1.6
104+
KUBECTL_VERSION ?= v1.34.2
105+
WWHRD_VERSION ?= 06b99400ca6db678386ba5dc39bbbdcdadb664ff
106+
YQ_VERSION ?= 4.44.6
107+
108+
# exported because the e2e tests make use of it
109+
export KCP_VERSION ?= 0.28.1
110+
111+
APPLYCONFIGURATION_GEN_VERSION ?= v0.33.4
112+
CLIENT_GEN_VERSION ?= v0.33.4
113+
CONTROLLER_GEN_VERSION ?= v0.18.0
114+
KCP_CODEGEN_VERSION ?= v2.4.0
115+
RECONCILER_GEN_VERSION ?= v0.5.0
116+
117+
.PHONY: install-boilerplate
118+
install-boilerplate:
119+
@hack/uget.sh https://github.com/kubermatic-labs/boilerplate/releases/download/v{VERSION}/boilerplate_{VERSION}_{GOOS}_{GOARCH}.tar.gz boilerplate $(BOILERPLATE_VERSION)
120+
121+
.PHONY: install-envtest
122+
install-envtest:
123+
@GO_MODULE=true hack/uget.sh sigs.k8s.io/controller-runtime/tools/setup-envtest setup-envtest $(ENVTEST_VERSION)
124+
125+
GIMPS = $(UGET_DIRECTORY)/gimps-$(GIMPS_VERSION)
126+
127+
.PHONY: install-gimps
128+
install-gimps:
129+
@hack/uget.sh https://codeberg.org/xrstf/gimps/releases/download/v{VERSION}/gimps_{VERSION}_{GOOS}_{GOARCH}.tar.gz gimps $(GIMPS_VERSION)
130+
131+
.PHONY: install-goimports
132+
install-goimports:
133+
@GO_MODULE=true hack/uget.sh github.com/openshift-eng/openshift-goimports goimports $(GOIMPORTS_VERSION)
134+
135+
GOLANGCI_LINT = $(UGET_DIRECTORY)/golangci-lint-$(GOLANGCI_LINT_VERSION)
136+
137+
.PHONY: install-golangci-lint
138+
install-golangci-lint:
139+
@hack/uget.sh https://github.com/golangci/golangci-lint/releases/download/v{VERSION}/golangci-lint-{VERSION}-{GOOS}-{GOARCH}.tar.gz golangci-lint $(GOLANGCI_LINT_VERSION)
140+
141+
.PHONY: install-kubectl
142+
install-kubectl:
143+
@UNCOMPRESSED=true hack/uget.sh https://dl.k8s.io/release/{VERSION}/bin/{GOOS}/{GOARCH}/kubectl kubectl $(KUBECTL_VERSION) kubectl
144+
145+
# wwhrd is installed as a Go module rather than from the provided
146+
# binaries because there is no arm64 binary available from the author.
147+
# See https://github.com/frapposelli/wwhrd/issues/141
148+
.PHONY: install-wwhrd
149+
install-wwhrd:
150+
@GO_MODULE=true hack/uget.sh github.com/frapposelli/wwhrd wwhrd $(WWHRD_VERSION)
151+
152+
.PHONY: install-yq
153+
install-yq:
154+
@UNCOMPRESSED=true hack/uget.sh https://github.com/mikefarah/yq/releases/download/v{VERSION}/yq_{GOOS}_{GOARCH} yq $(YQ_VERSION) yq_*
155+
156+
.PHONY: install-kcp
157+
install-kcp:
158+
@hack/uget.sh https://github.com/kcp-dev/kcp/releases/download/v{VERSION}/kcp_{VERSION}_{GOOS}_{GOARCH}.tar.gz kcp $(KCP_VERSION)
159+
160+
.PHONY: install-applyconfiguration-gen
161+
install-applyconfiguration-gen:
162+
@GO_MODULE=true hack/uget.sh k8s.io/code-generator/cmd/applyconfiguration-gen applyconfiguration-gen $(APPLYCONFIGURATION_GEN_VERSION)
163+
164+
.PHONY: install-client-gen
165+
install-client-gen:
166+
@GO_MODULE=true hack/uget.sh k8s.io/code-generator/cmd/client-gen client-gen $(CLIENT_GEN_VERSION)
167+
168+
.PHONY: install-controller-gen
169+
install-controller-gen:
170+
@GO_MODULE=true hack/uget.sh sigs.k8s.io/controller-tools/cmd/controller-gen controller-gen $(CONTROLLER_GEN_VERSION)
171+
172+
.PHONY: install-kcp-codegen
173+
install-kcp-codegen:
174+
@GO_MODULE=true hack/uget.sh github.com/kcp-dev/code-generator/v2 kcp-code-generator $(KCP_CODEGEN_VERSION) code-generator
175+
176+
.PHONY: install-reconciler-gen
177+
install-reconciler-gen:
178+
@GO_MODULE=true hack/uget.sh k8c.io/reconciler/cmd/reconciler-gen reconciler-gen $(RECONCILER_GEN_VERSION)
179+
180+
# This target can be used to conveniently update the checksums for all checksummed tools.
181+
# Combine with GOARCH to update for other archs, like "GOARCH=arm64 make update-tools".
182+
183+
.PHONY: update-tools
184+
update-tools: UGET_UPDATE=true
185+
update-tools: clean install-boilerplate install-gimps install-golangci-lint install-kubectl install-yq
186+
187+
############################################################################
164188
### docs
165189

166190
VENVDIR=$(abspath docs/venv)

go.mod

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ require (
1616
github.com/go-logr/zapr v1.3.0
1717
github.com/google/go-cmp v0.7.0
1818
github.com/kcp-dev/api-syncagent/sdk v0.0.0-00010101000000-000000000000
19-
github.com/kcp-dev/code-generator/v2 v2.4.0
2019
github.com/kcp-dev/kcp v0.28.1
2120
github.com/kcp-dev/kcp/sdk v0.28.1
2221
github.com/kcp-dev/logicalcluster/v3 v3.0.5
2322
github.com/kcp-dev/multicluster-provider v0.2.1-0.20250901093233-9ef571c8bd47
24-
github.com/openshift-eng/openshift-goimports v0.0.0-20230304234052-c70783e636f2
2523
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
2624
github.com/spf13/cobra v1.10.1
2725
github.com/spf13/pflag v1.0.10
@@ -38,12 +36,10 @@ require (
3836
k8s.io/apimachinery v0.33.4
3937
k8s.io/apiserver v0.33.4
4038
k8s.io/client-go v0.33.4
41-
k8s.io/code-generator v0.33.4
4239
k8s.io/component-base v0.33.4
4340
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff
4441
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
4542
sigs.k8s.io/controller-runtime v0.21.0
46-
sigs.k8s.io/controller-tools v0.18.0
4743
sigs.k8s.io/multicluster-runtime v0.21.0-alpha.9
4844
sigs.k8s.io/yaml v1.4.0
4945
)
@@ -64,7 +60,6 @@ require (
6460
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
6561
github.com/distribution/reference v0.6.0 // indirect
6662
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
67-
github.com/fatih/color v1.18.0 // indirect
6863
github.com/felixge/httpsnoop v1.0.4 // indirect
6964
github.com/fsnotify/fsnotify v1.9.0 // indirect
7065
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -83,8 +78,6 @@ require (
8378
github.com/go-openapi/swag/stringutils v0.24.0 // indirect
8479
github.com/go-openapi/swag/typeutils v0.24.0 // indirect
8580
github.com/go-openapi/swag/yamlutils v0.24.0 // indirect
86-
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
87-
github.com/gobuffalo/flect v1.0.3 // indirect
8881
github.com/gogo/protobuf v1.3.2 // indirect
8982
github.com/golang/protobuf v1.5.4 // indirect
9083
github.com/google/btree v1.1.3 // indirect
@@ -102,29 +95,20 @@ require (
10295
github.com/kcp-dev/client-go v0.0.0-20250728134101-0355faa9361b // indirect
10396
github.com/kylelemons/godebug v1.1.0 // indirect
10497
github.com/mailru/easyjson v0.9.1 // indirect
105-
github.com/mattn/go-colorable v0.1.14 // indirect
106-
github.com/mattn/go-isatty v0.0.20 // indirect
10798
github.com/mitchellh/copystructure v1.2.0 // indirect
108-
github.com/mitchellh/go-homedir v1.1.0 // indirect
10999
github.com/mitchellh/reflectwalk v1.0.2 // indirect
110100
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
111101
github.com/modern-go/reflect2 v1.0.2 // indirect
112102
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
113103
github.com/onsi/gomega v1.38.2 // indirect
114104
github.com/opencontainers/go-digest v1.0.0 // indirect
115-
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
116105
github.com/prometheus/client_golang v1.22.0 // indirect
117106
github.com/prometheus/client_model v0.6.1 // indirect
118107
github.com/prometheus/common v0.63.0 // indirect
119108
github.com/prometheus/procfs v0.16.0 // indirect
120-
github.com/sagikazarmark/locafero v0.7.0 // indirect
121109
github.com/shopspring/decimal v1.4.0 // indirect
122-
github.com/sourcegraph/conc v0.3.0 // indirect
123-
github.com/spf13/afero v1.14.0 // indirect
124110
github.com/spf13/cast v1.7.1 // indirect
125-
github.com/spf13/viper v1.20.1 // indirect
126111
github.com/stoewer/go-strcase v1.3.0 // indirect
127-
github.com/subosito/gotenv v1.6.0 // indirect
128112
github.com/tidwall/match v1.1.1 // indirect
129113
github.com/tidwall/pretty v1.2.1 // indirect
130114
github.com/x448/float16 v0.8.4 // indirect
@@ -145,28 +129,23 @@ require (
145129
go.yaml.in/yaml/v3 v3.0.4 // indirect
146130
golang.org/x/crypto v0.41.0 // indirect
147131
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
148-
golang.org/x/mod v0.27.0 // indirect
149132
golang.org/x/net v0.43.0 // indirect
150133
golang.org/x/oauth2 v0.29.0 // indirect
151134
golang.org/x/sync v0.16.0 // indirect
152135
golang.org/x/sys v0.35.0 // indirect
153136
golang.org/x/term v0.34.0 // indirect
154137
golang.org/x/text v0.28.0 // indirect
155138
golang.org/x/time v0.11.0 // indirect
156-
golang.org/x/tools v0.36.0 // indirect
157-
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect
158139
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
159140
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect
160141
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
161142
google.golang.org/grpc v1.71.1 // indirect
162143
google.golang.org/protobuf v1.36.7 // indirect
163144
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
164145
gopkg.in/inf.v0 v0.9.1 // indirect
165-
gopkg.in/yaml.v2 v2.4.0 // indirect
166146
gopkg.in/yaml.v3 v3.0.1 // indirect
167147
k8s.io/component-helpers v0.32.3 // indirect
168148
k8s.io/controller-manager v0.32.3 // indirect
169-
k8s.io/gengo/v2 v2.0.0-20250513215321-e3bc6f1e78b4 // indirect
170149
k8s.io/klog/v2 v2.130.1 // indirect
171150
k8s.io/kubernetes v1.33.3 // indirect
172151
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect

0 commit comments

Comments
 (0)