From 3713201f622597cbb03a0b104f2e3f5d0945aa30 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 29 Jun 2021 22:27:54 +0300 Subject: [PATCH] [#106] serivce/ir: Add NeoFS CLI binary in required artifacts Signed-off-by: Alex Vanin --- .env | 4 ++++ services/ir/artifacts.mk | 26 ++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.env b/.env index c642afb..c5e9252 100644 --- a/.env +++ b/.env @@ -28,3 +28,7 @@ S3_GW_IMAGE=nspccdev/neofs-s3-gw # NeoFS LOCODE database LOCODE_DB_URL=https://github.com/nspcc-dev/neofs-locode-db/releases/download/v0.1.0/locode_db.gz #LOCODE_DB_PATH=/path/to/locode_db + +# NeoFS CLI binary +NEOFS_CLI_URL=https://github.com/nspcc-dev/neofs-node/releases/download/v0.22.0/neofs-cli-v0.22.0-amd64.tar.gz +#NEOFS_CLI_PATH=/path/to/neofs-cli-binary diff --git a/services/ir/artifacts.mk b/services/ir/artifacts.mk index 3dac781..fa009b1 100644 --- a/services/ir/artifacts.mk +++ b/services/ir/artifacts.mk @@ -3,8 +3,10 @@ LOCODE_DB_ARCHIVE_PATH=./vendor LOCODE_DB_ARCHIVE_FILE=locode_db.gz -get.ir: LOCODE_DB_PATH?= -get.ir: +get.ir: get.locode get.cli + +get.locode: LOCODE_DB_PATH?= +get.locode: @mkdir -p ${LOCODE_DB_ARCHIVE_PATH} ifeq (${LOCODE_DB_PATH},) @@ -18,3 +20,23 @@ else endif gzip -dfk ${LOCODE_DB_ARCHIVE_PATH}/${LOCODE_DB_ARCHIVE_FILE} + +.ONESHELL: +get.cli: NEOFS_CLI_FILE=./vendor/neofs-cli +get.cli: NEOFS_CLI_ARCHIVE_FILE=${NEOFS_CLI_FILE}.tar.gz +get.cli: NEOFS_CLI_PATH?= +get.cli: + @mkdir -p ./vendor + +ifeq (${NEOFS_CLI_PATH},) + @echo "⇒ Download NeoFS CLI binary from ${NEOFS_CLI_URL}" + @curl \ + -sSL "${NEOFS_CLI_URL}" \ + -o ${NEOFS_CLI_ARCHIVE_FILE} + @tar -xvf ${NEOFS_CLI_ARCHIVE_FILE} -C ./vendor | xargs -I {} \ + mv ./vendor/{} ${NEOFS_CLI_FILE} + @rm ${NEOFS_CLI_ARCHIVE_FILE} +else + @echo "⇒ Copy local binary from ${NEOFS_CLI_PATH}" + @cp ${NEOFS_CLI_PATH} ${NEOFS_CLI_FILE} +endif