File tree Expand file tree Collapse file tree 2 files changed +39
-7
lines changed Expand file tree Collapse file tree 2 files changed +39
-7
lines changed Original file line number Diff line number Diff line change @@ -284,13 +284,8 @@ OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
284
284
operator-sdk : # # Download operator-sdk locally if necessary.
285
285
ifeq (,$(wildcard $(OPERATOR_SDK ) ) )
286
286
ifeq (, $(shell which operator-sdk 2>/dev/null) )
287
- @{ \
288
- set -e ;\
289
- mkdir -p $(dir $(OPERATOR_SDK)) ;\
290
- OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
291
- curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
292
- chmod +x $(OPERATOR_SDK) ;\
293
- }
287
+ mkdir -p $(dir $(OPERATOR_SDK))
288
+ hack/operator-sdk.sh $(OPERATOR_SDK) $(OPERATOR_SDK_VERSION)
294
289
else
295
290
OPERATOR_SDK = $(shell which operator-sdk)
296
291
endif
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -e
4
+
5
+ OUTPUT_PATH=${1:- ./ bin/ operator-sdk}
6
+ VERSION=${2:- " v1.39.0" }
7
+
8
+ GOOS=$( go env GOOS)
9
+ GOARCH=$( go env GOARCH)
10
+ BIN=" operator-sdk"
11
+ BIN_ARCH=" ${BIN} _${GOOS} _${GOARCH} "
12
+ OPERATOR_SDK_DL_URL=" https://github.com/operator-framework/operator-sdk/releases/download/${VERSION} "
13
+
14
+ if [[ " $GOOS " != " linux" && " $GOOS " != " darwin" ]]; then
15
+ echo " Unsupported OS $GOOS "
16
+ exit 1
17
+ fi
18
+
19
+ if [[ " $GOARCH " != " amd64" && " $GOARCH " != " arm64" && " $GOARCH " != " ppc64le" && " $GOARCH " != " s390x" ]]; then
20
+ echo " Unsupported architecture $GOARCH "
21
+ exit 1
22
+ fi
23
+
24
+ command -v curl & > /dev/null || { echo " can't find curl command" && exit 1; }
25
+
26
+ TEMPDIR=$( mktemp -d)
27
+ BIN_PATH=" ${TEMPDIR} /${BIN_ARCH} "
28
+
29
+ echo " > downloading binary"
30
+ curl --location -o " ${BIN_PATH} " " ${OPERATOR_SDK_DL_URL} /operator-sdk_${GOOS} _${GOARCH} "
31
+
32
+ echo " > installing binary"
33
+ mv " ${BIN_PATH} " " ${OUTPUT_PATH} "
34
+ chmod +x " ${OUTPUT_PATH} "
35
+ rm -rf " ${TEMPDIR} "
36
+
37
+ echo " > operator-sdk binary available at ${OUTPUT_PATH} "
You can’t perform that action at this time.
0 commit comments