@@ -18,11 +18,18 @@ K0S_BINARY_SOURCE_OVERRIDE =
1818TROUBLESHOOT_VERSION = v0.117.0
1919
2020KOTS_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
2322KOTS_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
2424# For dev env, build the kots binary in the kots repo with "make kots-linux-arm64" and set this to "../kots/bin/kots"
2525KOTS_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+
2633# TODO: move this to a manifest file
2734LOCAL_ARTIFACT_MIRROR_IMAGE ?= proxy.replicated.com/anonymous/replicated/embedded-cluster-local-artifact-mirror:$(VERSION )
2835# 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)
3845K0S_BINARY_SOURCE_OVERRIDE = https://tf-staging-embedded-cluster-bin.s3.amazonaws.com/custom-k0s-binaries/k0s-v1.28.14%2Bk0s.0-ec.0-$(ARCH )
3946endif
4047
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-
4548LD_FLAGS = \
4649 -X github.com/replicatedhq/embedded-cluster/pkg/versions.K0sVersion=$(K0S_VERSION ) \
4750 -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)
6972
7073.PHONY : cmd/installer/goods/bins/k0s
7174cmd/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-% :
7775 mkdir -p output/bins
7876 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 $@ ; \
8079 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 ) $@ ; \
8282 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) "
8395 chmod +x $@
8496 touch $@
8597
8698.PHONY : cmd/installer/goods/bins/kubectl-support_bundle
8799cmd/installer/goods/bins/kubectl-support_bundle :
88100 $(MAKE ) output/bins/kubectl-support_bundle-$(TROUBLESHOOT_VERSION ) -$(ARCH )
89- mkdir -p cmd/installer/goods/bins
90101 cp output/bins/kubectl-support_bundle-$(TROUBLESHOOT_VERSION ) -$(ARCH ) $@
91102
92103output/bins/kubectl-support_bundle-% :
93104 mkdir -p output/bins
94105 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"
96108 tar -xzf output/tmp/support-bundle.tar.gz -C output/tmp
97109 mv output/tmp/support-bundle $@
98110 rm -rf output/tmp
@@ -101,27 +113,26 @@ output/bins/kubectl-support_bundle-%:
101113.PHONY : cmd/installer/goods/bins/kubectl-preflight
102114cmd/installer/goods/bins/kubectl-preflight :
103115 $(MAKE ) output/bins/kubectl-preflight-$(TROUBLESHOOT_VERSION ) -$(ARCH )
104- mkdir -p cmd/installer/goods/bins
105116 cp output/bins/kubectl-preflight-$(TROUBLESHOOT_VERSION ) -$(ARCH ) $@
106117
107118output/bins/kubectl-preflight-% :
108119 mkdir -p output/bins
109120 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
111123 tar -xzf output/tmp/preflight.tar.gz -C output/tmp
112124 mv output/tmp/preflight $@
113125 rm -rf output/tmp
114126 touch $@
115127
116128.PHONY : cmd/installer/goods/bins/local-artifact-mirror
117129cmd/installer/goods/bins/local-artifact-mirror :
118- mkdir -p cmd/installer/goods/bins
119130 $(MAKE ) -C local-artifact-mirror build OS=$(OS ) ARCH=$(ARCH )
120131 cp local-artifact-mirror/bin/local-artifact-mirror-$(OS ) -$(ARCH ) $@
121132 touch $@
122133
123134ifndef 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)
125136endif
126137
127138output/bins/fio-% :
@@ -136,13 +147,11 @@ output/bins/fio-%:
136147cmd/installer/goods/bins/fio :
137148ifneq ($(DISABLE_FIO_BUILD ) ,1)
138149 $(MAKE) output/bins/fio-$(FIO_VERSION)-$(ARCH)
139- mkdir -p cmd/installer/goods/bins
140150 cp output/bins/fio-$(FIO_VERSION)-$(ARCH) $@
141151endif
142152
143153.PHONY : cmd/installer/goods/internal/bins/kubectl-kots
144154cmd/installer/goods/internal/bins/kubectl-kots :
145- mkdir -p cmd/installer/goods/internal/bins
146155 if [ " $( KOTS_BINARY_URL_OVERRIDE) " != " " ]; then \
147156 $(MAKE ) output/bins/kubectl-kots-override ; \
148157 cp output/bins/kubectl-kots-override $@ ; \
@@ -157,7 +166,8 @@ cmd/installer/goods/internal/bins/kubectl-kots:
157166output/bins/kubectl-kots-% :
158167 mkdir -p output/bins
159168 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"
161171 tar -xzf output/tmp/kots.tar.gz -C output/tmp
162172 mv output/tmp/kots $@
163173 touch $@
@@ -166,7 +176,11 @@ output/bins/kubectl-kots-%:
166176output/bins/kubectl-kots-override :
167177 mkdir -p output/bins
168178 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
170184 tar -xzf output/tmp/kots.tar.gz -C output/tmp
171185 mv output/tmp/kots $@
172186 touch $@
@@ -218,7 +232,6 @@ static: cmd/installer/goods/bins/k0s \
218232
219233.PHONY : static-dryrun
220234static-dryrun :
221- @mkdir -p cmd/installer/goods/bins cmd/installer/goods/internal/bins
222235 @touch cmd/installer/goods/bins/k0s \
223236 cmd/installer/goods/bins/kubectl-preflight \
224237 cmd/installer/goods/bins/kubectl-support_bundle \
@@ -261,14 +274,12 @@ envtest:
261274
262275.PHONY : unit-tests
263276unit-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
266277 KUBEBUILDER_ASSETS=" $( shell ./operator/bin/setup-envtest use $( ENVTEST_K8S_VERSION) --bin-dir $( shell pwd) /operator/bin -p path) " \
267278 go test -tags exclude_graphdriver_btrfs -v ./pkg/... ./cmd/...
268279 $(MAKE ) -C operator test
269280
270281.PHONY : vet
271- vet : static
282+ vet :
272283 go vet -tags exclude_graphdriver_btrfs ./...
273284
274285.PHONY : e2e-tests
@@ -318,8 +329,6 @@ scan:
318329
319330.PHONY : buildtools
320331buildtools :
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
323332 go build -tags exclude_graphdriver_btrfs -o ./output/bin/buildtools ./cmd/buildtools
324333
325334.PHONY : list-distros
0 commit comments