This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit e614c49c9837cce9d2b4c85f517a5343a8f1452c Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Thu Jan 5 14:43:25 2023 +0100 fix: Download opm binary instead of go install --- script/Makefile | 17 +++++++++++++++-- script/build_install_opm.sh | 37 ------------------------------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/script/Makefile b/script/Makefile index 6cd07a512..b9e17b711 100644 --- a/script/Makefile +++ b/script/Makefile @@ -546,11 +546,24 @@ else OPERATOR_SDK=$(shell command -v operator-sdk 2> /dev/null) endif -opm: +opm: detect-os ifeq (, $(shell command -v opm 2> /dev/null)) - @OPM_VERSION=$(OPM_VERSION) ./script/build_install_opm.sh + @{ \ + set -e ;\ + curl \ + -L https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION)/$(OS_LOWER)-amd64-opm \ + -o opm; \ + chmod +x opm;\ + mkdir -p $(GOBIN) ;\ + mv opm $(GOBIN)/ ;\ + } OPM=$(GOBIN)/opm else + @{ \ + echo -n "opm already installed: "; \ + opm version | sed -n 's/.*"v\([^"]*\)".*/\1/p'; \ + echo " If this is less than $(OPM_VERSION) then please consider moving it aside and allowing the approved version to be downloaded."; \ + } OPM=$(shell command -v opm 2> /dev/null) endif diff --git a/script/build_install_opm.sh b/script/build_install_opm.sh deleted file mode 100755 index 795a5bb7b..000000000 --- a/script/build_install_opm.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -set +e - -check_env_var() { - if [ -z "${2}" ]; then - echo "Error: ${1} env var not defined" - exit 1 - fi -} - -check_env_var "OPM_VERSION" ${OPM_VERSION} - -OPM_PKG=github.com/operator-framework/operator-registry -# -# Timestamp for the building of the operator -# -BUILD_TIME=$(date +%Y-%m-%dT%H:%M:%S%z) - -OPM_GEN_TMP_DIR=$(mktemp -d) -echo "Using temporary directory ${OPM_GEN_TMP_DIR}" -cd ${OPM_GEN_TMP_DIR} - -go mod init tmp ;\ -go get \ - -ldflags '-w -extldflags "-static"' -tags "json1" \ - -ldflags "-X '${OPM_PKG}/cmd/opm/version.opmVersion=${OPM_VERSION}'" \ - ${OPM_PKG}/cmd/opm@${OPM_VERSION} ;\ - -if [ $? != 0 ]; then - echo "Error: Failed to install opm version ${OPM_VERSION}" - exit 1 -fi - -echo "OPM Version ..." -opm version - -rm -rf ${OPM_GEN_TMP_DIR}