@@ -18,11 +18,18 @@ K0S_BINARY_SOURCE_OVERRIDE =
18
18
TROUBLESHOOT_VERSION = v0.117.0
19
19
20
20
KOTS_VERSION = v$(shell awk '/^version/{print $$2}' pkg/addons/adminconsole/static/metadata.yaml | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+) .*/\1/')
21
- # When updating KOTS_BINARY_URL_OVERRIDE, also update the KOTS_VERSION above or
22
- # scripts/ci-upload-binaries.sh may find the version in the cache and not upload the overridden binary.
21
+ # If KOTS_BINARY_URL_OVERRIDE is set to a ttl.sh artifact, there's NO need to update the KOTS_VERSION above as it will be dynamically generated
23
22
KOTS_BINARY_URL_OVERRIDE =
23
+ # If KOTS_BINARY_FILE_OVERRIDE is set, there's NO need to update the KOTS_VERSION above as it will be dynamically generated
24
24
# For dev env, build the kots binary in the kots repo with "make kots-linux-arm64" and set this to "../kots/bin/kots"
25
25
KOTS_BINARY_FILE_OVERRIDE =
26
+
27
+ ifeq ($(findstring ttl.sh,$(KOTS_BINARY_URL_OVERRIDE ) ) ,ttl.sh)
28
+ KOTS_VERSION = kots-dev-$(shell oras manifest fetch $(KOTS_BINARY_URL_OVERRIDE ) | jq '.layers[0].digest' | cut -c9-15)
29
+ else ifdef KOTS_BINARY_FILE_OVERRIDE
30
+ KOTS_VERSION = kots-dev-$(shell shasum -a 256 $(KOTS_BINARY_FILE_OVERRIDE ) | cut -c1-8)
31
+ endif
32
+
26
33
# TODO: move this to a manifest file
27
34
LOCAL_ARTIFACT_MIRROR_IMAGE ?= proxy.replicated.com/anonymous/replicated/embedded-cluster-local-artifact-mirror:$(VERSION )
28
35
# These are used to override the binary urls in dev and e2e tests
@@ -38,10 +45,6 @@ else ifeq ($(K0S_VERSION),v1.28.14+k0s.0-ec.0)
38
45
K0S_BINARY_SOURCE_OVERRIDE = https://tf-staging-embedded-cluster-bin.s3.amazonaws.com/custom-k0s-binaries/k0s-v1.28.14%2Bk0s.0-ec.0-$(ARCH )
39
46
endif
40
47
41
- ifneq ($(KOTS_BINARY_FILE_OVERRIDE ) ,)
42
- KOTS_VERSION = kots-dev-$(shell shasum -a 256 $(KOTS_BINARY_FILE_OVERRIDE ) | cut -c1-8)
43
- endif
44
-
45
48
LD_FLAGS = \
46
49
-X github.com/replicatedhq/embedded-cluster/pkg/versions.K0sVersion=$(K0S_VERSION ) \
47
50
-X github.com/replicatedhq/embedded-cluster/pkg/versions.Version=$(VERSION ) \
@@ -69,30 +72,39 @@ random-string = $(shell LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c6)
69
72
70
73
.PHONY : cmd/installer/goods/bins/k0s
71
74
cmd/installer/goods/bins/k0s :
72
- $(MAKE ) output/bins/k0s-$(K0S_VERSION ) -$(ARCH )
73
- mkdir -p cmd/installer/goods/bins
74
- cp output/bins/k0s-$(K0S_VERSION ) -$(ARCH ) $@
75
-
76
- output/bins/k0s-% :
77
75
mkdir -p output/bins
78
76
if [ " $( K0S_BINARY_SOURCE_OVERRIDE) " != " " ]; then \
79
- curl --retry 5 --retry-all-errors -fL -o $@ " $( K0S_BINARY_SOURCE_OVERRIDE) " ; \
77
+ $(MAKE ) output/bins/k0s-override ; \
78
+ cp output/bins/k0s-override $@ ; \
80
79
else \
81
- curl --retry 5 --retry-all-errors -fL -o $@ " https://github.com/k0sproject/k0s/releases/download/$( call split-hyphen,$* ,1) /k0s-$( call split-hyphen,$* ,1) -$( call split-hyphen,$* ,2) " ; \
80
+ $(MAKE ) output/bins/k0s-$(K0S_VERSION ) -$(ARCH ) ; \
81
+ cp output/bins/k0s-$(K0S_VERSION ) -$(ARCH ) $@ ; \
82
82
fi
83
+
84
+ output/bins/k0s-% :
85
+ curl --retry 5 --retry-all-errors -fL -o $@ \
86
+ " https://github.com/k0sproject/k0s/releases/download/$( call split-hyphen,$* ,1) /k0s-$( call split-hyphen,$* ,1) -$( call split-hyphen,$* ,2) "
87
+ chmod +x $@
88
+ touch $@
89
+
90
+ .PHONY : output/bins/k0s-override
91
+ output/bins/k0s-override :
92
+ mkdir -p output/bins
93
+ curl --retry 5 --retry-all-errors -fL -o $@ \
94
+ " $( K0S_BINARY_SOURCE_OVERRIDE) "
83
95
chmod +x $@
84
96
touch $@
85
97
86
98
.PHONY : cmd/installer/goods/bins/kubectl-support_bundle
87
99
cmd/installer/goods/bins/kubectl-support_bundle :
88
100
$(MAKE ) output/bins/kubectl-support_bundle-$(TROUBLESHOOT_VERSION ) -$(ARCH )
89
- mkdir -p cmd/installer/goods/bins
90
101
cp output/bins/kubectl-support_bundle-$(TROUBLESHOOT_VERSION ) -$(ARCH ) $@
91
102
92
103
output/bins/kubectl-support_bundle-% :
93
104
mkdir -p output/bins
94
105
mkdir -p output/tmp
95
- curl --retry 5 --retry-all-errors -fL -o output/tmp/support-bundle.tar.gz " https://github.com/replicatedhq/troubleshoot/releases/download/$( call split-hyphen,$* ,1) /support-bundle_$( OS) _$( call split-hyphen,$* ,2) .tar.gz"
106
+ curl --retry 5 --retry-all-errors -fL -o output/tmp/support-bundle.tar.gz \
107
+ " https://github.com/replicatedhq/troubleshoot/releases/download/$( call split-hyphen,$* ,1) /support-bundle_$( OS) _$( call split-hyphen,$* ,2) .tar.gz"
96
108
tar -xzf output/tmp/support-bundle.tar.gz -C output/tmp
97
109
mv output/tmp/support-bundle $@
98
110
rm -rf output/tmp
@@ -101,27 +113,26 @@ output/bins/kubectl-support_bundle-%:
101
113
.PHONY : cmd/installer/goods/bins/kubectl-preflight
102
114
cmd/installer/goods/bins/kubectl-preflight :
103
115
$(MAKE ) output/bins/kubectl-preflight-$(TROUBLESHOOT_VERSION ) -$(ARCH )
104
- mkdir -p cmd/installer/goods/bins
105
116
cp output/bins/kubectl-preflight-$(TROUBLESHOOT_VERSION ) -$(ARCH ) $@
106
117
107
118
output/bins/kubectl-preflight-% :
108
119
mkdir -p output/bins
109
120
mkdir -p output/tmp
110
- curl --retry 5 --retry-all-errors -fL -o output/tmp/preflight.tar.gz https://github.com/replicatedhq/troubleshoot/releases/download/$(call split-hyphen,$* ,1) /preflight_$(OS ) _$(call split-hyphen,$* ,2) .tar.gz
121
+ curl --retry 5 --retry-all-errors -fL -o output/tmp/preflight.tar.gz \
122
+ https://github.com/replicatedhq/troubleshoot/releases/download/$(call split-hyphen,$* ,1) /preflight_$(OS ) _$(call split-hyphen,$* ,2) .tar.gz
111
123
tar -xzf output/tmp/preflight.tar.gz -C output/tmp
112
124
mv output/tmp/preflight $@
113
125
rm -rf output/tmp
114
126
touch $@
115
127
116
128
.PHONY : cmd/installer/goods/bins/local-artifact-mirror
117
129
cmd/installer/goods/bins/local-artifact-mirror :
118
- mkdir -p cmd/installer/goods/bins
119
130
$(MAKE ) -C local-artifact-mirror build OS=$(OS ) ARCH=$(ARCH )
120
131
cp local-artifact-mirror/bin/local-artifact-mirror-$(OS ) -$(ARCH ) $@
121
132
touch $@
122
133
123
134
ifndef FIO_VERSION
124
- FIO_VERSION = $(shell curl -- retry 5 --retry-all-errors -fsSL https://api.github.com/repos/axboe/fio/releases/latest | jq -r '.tag_name' | cut -d- -f2)
135
+ FIO_VERSION = $(shell curl -fsSL -- retry 5 --retry-all-errors $( GH_AUTH_HEADER ) https://api.github.com/repos/axboe/fio/releases | jq -r '. | first | .tag_name' | cut -d- -f2)
125
136
endif
126
137
127
138
output/bins/fio-% :
@@ -136,13 +147,11 @@ output/bins/fio-%:
136
147
cmd/installer/goods/bins/fio :
137
148
ifneq ($(DISABLE_FIO_BUILD ) ,1)
138
149
$(MAKE) output/bins/fio-$(FIO_VERSION)-$(ARCH)
139
- mkdir -p cmd/installer/goods/bins
140
150
cp output/bins/fio-$(FIO_VERSION)-$(ARCH) $@
141
151
endif
142
152
143
153
.PHONY : cmd/installer/goods/internal/bins/kubectl-kots
144
154
cmd/installer/goods/internal/bins/kubectl-kots :
145
- mkdir -p cmd/installer/goods/internal/bins
146
155
if [ " $( KOTS_BINARY_URL_OVERRIDE) " != " " ]; then \
147
156
$(MAKE ) output/bins/kubectl-kots-override ; \
148
157
cp output/bins/kubectl-kots-override $@ ; \
@@ -157,7 +166,8 @@ cmd/installer/goods/internal/bins/kubectl-kots:
157
166
output/bins/kubectl-kots-% :
158
167
mkdir -p output/bins
159
168
mkdir -p output/tmp
160
- curl --retry 5 --retry-all-errors -fL -o output/tmp/kots.tar.gz " https://github.com/replicatedhq/kots/releases/download/$( call split-hyphen,$* ,1) /kots_$( OS) _$( call split-hyphen,$* ,2) .tar.gz"
169
+ curl --retry 5 --retry-all-errors -fL -o output/tmp/kots.tar.gz \
170
+ " https://github.com/replicatedhq/kots/releases/download/$( call split-hyphen,$* ,1) /kots_$( OS) _$( call split-hyphen,$* ,2) .tar.gz"
161
171
tar -xzf output/tmp/kots.tar.gz -C output/tmp
162
172
mv output/tmp/kots $@
163
173
touch $@
@@ -166,7 +176,11 @@ output/bins/kubectl-kots-%:
166
176
output/bins/kubectl-kots-override :
167
177
mkdir -p output/bins
168
178
mkdir -p output/tmp
169
- curl --retry 5 --retry-all-errors -fL -o output/tmp/kots.tar.gz " $( KOTS_BINARY_URL_OVERRIDE) "
179
+ if [[ " $( KOTS_BINARY_URL_OVERRIDE) " == ttl.sh* ]]; then \
180
+ oras pull " $( KOTS_BINARY_URL_OVERRIDE) " --output output/tmp ; \
181
+ else \
182
+ curl --retry 5 --retry-all-errors -fL -o output/tmp/kots.tar.gz " $( KOTS_BINARY_URL_OVERRIDE) " ; \
183
+ fi
170
184
tar -xzf output/tmp/kots.tar.gz -C output/tmp
171
185
mv output/tmp/kots $@
172
186
touch $@
@@ -218,7 +232,6 @@ static: cmd/installer/goods/bins/k0s \
218
232
219
233
.PHONY : static-dryrun
220
234
static-dryrun :
221
- @mkdir -p cmd/installer/goods/bins cmd/installer/goods/internal/bins
222
235
@touch cmd/installer/goods/bins/k0s \
223
236
cmd/installer/goods/bins/kubectl-preflight \
224
237
cmd/installer/goods/bins/kubectl-support_bundle \
@@ -261,14 +274,12 @@ envtest:
261
274
262
275
.PHONY : unit-tests
263
276
unit-tests : envtest
264
- mkdir -p cmd/installer/goods/bins cmd/installer/goods/internal/bins
265
- touch cmd/installer/goods/bins/BUILD cmd/installer/goods/internal/bins/BUILD # compilation will fail if no files are present
266
277
KUBEBUILDER_ASSETS=" $( shell ./operator/bin/setup-envtest use $( ENVTEST_K8S_VERSION) --bin-dir $( shell pwd) /operator/bin -p path) " \
267
278
go test -tags exclude_graphdriver_btrfs -v ./pkg/... ./cmd/...
268
279
$(MAKE ) -C operator test
269
280
270
281
.PHONY : vet
271
- vet : static
282
+ vet :
272
283
go vet -tags exclude_graphdriver_btrfs ./...
273
284
274
285
.PHONY : e2e-tests
@@ -318,8 +329,6 @@ scan:
318
329
319
330
.PHONY : buildtools
320
331
buildtools :
321
- mkdir -p cmd/installer/goods/bins cmd/installer/goods/internal/bins
322
- touch cmd/installer/goods/bins/BUILD cmd/installer/goods/internal/bins/BUILD # compilation will fail if no files are present
323
332
go build -tags exclude_graphdriver_btrfs -o ./output/bin/buildtools ./cmd/buildtools
324
333
325
334
.PHONY : list-distros
0 commit comments