Skip to content

Commit

Permalink
Check oc exist in Makefile
Browse files Browse the repository at this point in the history
This commit adds a check in the Makefile to see
if the `oc` binary exist. if not, download and install it.

Signed-off-by: Lior Noy <[email protected]>
  • Loading branch information
liornoy committed Apr 30, 2024
1 parent d1def49 commit ae78a57
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@ EXECUTABLE := commatrix-gen
build:
go build -o $(EXECUTABLE) $(GO_SRC)

# TODO: check if oc is installed
generate: build
oc:
ifeq (, $(shell which oc))
@{ \
set -e ;\
curl -LO https://github.com/openshift/oc/archive/refs/tags/openshift-clients-4.15.0-202402082307.tar.gz ;\
tar -xf openshift-clients-4.15.0-202402082307.tar.gz ;\
cd $(PWD)/oc-openshift-clients-4.15.0-202402082307 ;\
make oc ;\
mv oc $(GOBIN)/oc ;\
chmod u+x $(GOBIN)/oc ;\
rm -rf $(PWD)/oc-openshift-clients-4.15.0-202402082307 ;\
rm $(PWD)/openshift-clients-4.15.0-202402082307.tar.gz ;\
}
endif

generate: oc build
mkdir -p $(DEST_DIR)/communication-matrix
./$(EXECUTABLE) -format=$(FORMAT) -env=$(CLUSTER_ENV) -destDir=$(DEST_DIR)/communication-matrix -deployment=$(DEPLOYMENT)

Expand Down

0 comments on commit ae78a57

Please sign in to comment.