Skip to content

Commit fa41349

Browse files
authored
fix: adjust urls and OS check for make tools (#1053)
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
1 parent 6fa1c36 commit fa41349

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

.github/tools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
golangci-lint v1.63.4
44
controller-gen v0.19.0
55
kustomize v5.5.0
6-
oc v4.8.11
6+
oc 4.17.12
77
operator-sdk v1.41.1
88
opm v1.57.0
99
promq v0.0.1

Makefile.tools

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ GOLANGCI_LINT_VERSION = v1.63.4
2727
PROMQ = $(TOOLS_DIR)/promq
2828
PROMQ_VERSION = v0.0.1
2929

30-
# NOTE: oc is NOT downloadable using the OC_VERSION in its URL, so this has to be manually updated
3130
OC = $(TOOLS_DIR)/oc
32-
OC_VERSION = v4.8.11
31+
OC_VERSION = 4.17.12
3332

3433
CRDOC = $(TOOLS_DIR)/crdoc
3534
CRDOC_VERSION = v0.6.2
@@ -110,12 +109,14 @@ $(OC) oc: $(TOOLS_DIR)
110109
set -ex ;\
111110
[[ -f $(OC) ]] && exit 0 ;\
112111
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
113-
curl -sSLo $(OC) https://mirror.openshift.com/pub/openshift-v4/$${ARCH}/clients/oc/latest/$${OS}/oc.tar.gz ;\
114-
tar -xf $(TOOLS_DIR)/oc -C $(TOOLS_DIR) ;\
115-
rm -f $(TOOLS_DIR)/README.md ;\
116-
$(OC) version ;\
117-
version=$(OC_VERSION) ;\
118-
$(OC) version | grep -q $${version##v} ;\
112+
case $${OS} in darwin) OC_OS=mac ;; linux) OC_OS=linux ;; *) echo "unsupported OS: $${OS}" ; exit 1 ;; esac && \
113+
case $${ARCH} in arm64) OC_SUFFIX="-$${ARCH}" ;; amd64) OC_SUFFIX="" ;; *) echo "unsupported ARCH: $${ARCH}" ; exit 1 ;; esac && \
114+
OC_URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$(OC_VERSION)/openshift-client-$${OC_OS}$${OC_SUFFIX}.tar.gz" && \
115+
TMP_ARCHIVE=$$(mktemp) && \
116+
curl -sSLo $${TMP_ARCHIVE} $${OC_URL} && \
117+
tar -xzf $${TMP_ARCHIVE} -C $(TOOLS_DIR) && \
118+
rm -f $${TMP_ARCHIVE} $(TOOLS_DIR)/README.md && \
119+
$(OC) version --client ;\
119120
}
120121

121122
.PHONY: crdoc
@@ -132,7 +133,8 @@ $(SHELLCHECK) shellcheck: $(TOOLS_DIR)
132133
set -ex ;\
133134
[[ -f $(SHELLCHECK) ]] && exit 0 ;\
134135
cd $$(mktemp -d) ;\
135-
OS=$(shell go env GOOS) && ARCH=$(shell uname -m) && \
136+
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
137+
case $${ARCH} in arm64) ARCH=aarch64 ;; amd64) ARCH=x86_64 ;; *) echo "unsupported ARCH: $${ARCH}" ; exit 1 ;; esac && \
136138
curl -sSLo shellcheck-stable.tar.xz https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.$${OS}.$${ARCH}.tar.xz ;\
137139
tar -xJf shellcheck-stable.tar.xz ;\
138140
cp shellcheck-stable/shellcheck $(SHELLCHECK) ;\

0 commit comments

Comments
 (0)