Permalink
Browse files

Upload CLI without zipping it

  • Loading branch information...
deliahu committed Feb 12, 2019
1 parent de5c8db commit 645a77bc24b6bbedf9786a16d42b546a972ec48e
Showing with 10 additions and 26 deletions.
  1. +7 −22 build/cli.sh
  2. +1 −3 cortex.sh
  3. +2 −1 dev/build_cli.sh
@@ -20,34 +20,19 @@ set -euo pipefail
CORTEX_VERSION=master

function build_and_upload() {
goos=$1
file=$2
set -euo pipefail

GOOS=$goos GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build -installsuffix cgo -o cortex github.com/cortexlabs/cortex/cli

zip -q $file cortex
os=$1
GOOS=$os GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build -installsuffix cgo -o cortex github.com/cortexlabs/cortex/cli
aws s3 cp cortex s3://$CLI_BUCKET_NAME/$CORTEX_VERSION/cli/$os/cortex --only-show-errors
rm cortex

aws s3 cp $file s3://$CLI_BUCKET_NAME --only-show-errors
rm $file

echo "Uploaded $file to s3://$CLI_BUCKET_NAME"
echo "Uploaded CLI to s3://$CLI_BUCKET_NAME/$CORTEX_VERSION/cli/$os/cortex"
}

###########
### Mac ###
###########

echo ""
echo "Building Cortex CLI for Mac"

build_and_upload darwin "cortex-cli-$CORTEX_VERSION-darwin.zip"

#############
### Linux ###
#############
build_and_upload darwin

echo ""
echo "Building Cortex CLI for Linux"

build_and_upload linux "cortex-cli-$CORTEX_VERSION-linux.zip"
build_and_upload linux
@@ -1805,13 +1805,11 @@ function install_cortex_cli() {
fi

check_dep_curl
check_dep_unzip

echo -e "\nInstalling the Cortex CLI (/usr/local/bin/cortex) ..."

rm -rf $CORTEX_SH_TMP_DIR && mkdir -p $CORTEX_SH_TMP_DIR
curl -s -o $CORTEX_SH_TMP_DIR/cortex-cli-${CORTEX_VERSION_STABLE}-${PARSED_OS}.zip https://s3-us-west-2.amazonaws.com/get-cortex/cortex-cli-${CORTEX_VERSION_STABLE}-${PARSED_OS}.zip
unzip $CORTEX_SH_TMP_DIR/cortex-cli-${CORTEX_VERSION_STABLE}-${PARSED_OS}.zip -d $CORTEX_SH_TMP_DIR >/dev/null
curl -s -o $CORTEX_SH_TMP_DIR/cortex https://s3-us-west-2.amazonaws.com/get-cortex/$CORTEX_VERSION_STABLE/cli/$PARSED_OS/cortex
chmod +x $CORTEX_SH_TMP_DIR/cortex

if [ $(id -u) = 0 ]; then
@@ -19,5 +19,6 @@ set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null && pwd)"

export CLI_BUCKET_NAME="cortex-cli-david"
source $ROOT/dev/config/build.sh

$ROOT/build/cli.sh

0 comments on commit 645a77b

Please sign in to comment.