Permalink
Browse files

Convert bash variables to lower case

  • Loading branch information...
deliahu committed Feb 7, 2019
1 parent 9793377 commit f52bea632107a3e481632bacda6adca008cfc1c1
Showing with 45 additions and 44 deletions.
  1. +2 −2 build/cli.sh
  2. +6 −5 build/images.sh
  3. +3 −3 build/test.sh
  4. +34 −34 dev/registry.sh
@@ -20,10 +20,10 @@ set -euo pipefail
CORTEX_VERSION=master

function build_and_upload() {
GOOS=$1
goos=$1
file=$2

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

zip -q $file cortex
rm cortex
@@ -17,13 +17,14 @@

set -euo pipefail

DIR=$1
IMAGE=$2
CORTEX_VERSION=master

docker build . -f $DIR/Dockerfile -t cortexlabs/$IMAGE \
-t cortexlabs/$IMAGE:$CORTEX_VERSION
dir=$1
image=$2

docker build . -f $dir/Dockerfile -t cortexlabs/$image \
-t cortexlabs/$image:$CORTEX_VERSION

echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

docker push cortexlabs/$IMAGE:$CORTEX_VERSION
docker push cortexlabs/$image:$CORTEX_VERSION
@@ -28,11 +28,11 @@ function run_python_tests() {
docker run cortexlabs/test
}

CMD=${1:-""}
cmd=${1:-""}

if [ "$CMD" = "go" ]; then
if [ "$cmd" = "go" ]; then
run_go_tests
elif [ "$CMD" = "python" ]; then
elif [ "$cmd" = "python" ]; then
run_python_tests
else
run_go_tests
@@ -22,14 +22,14 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null && pwd)"
source $ROOT/dev/config/build.sh
source $ROOT/dev/util.sh

ECR_LOGGED_IN=false
ecr_logged_in=false

function ecr_login() {
if [ "$ECR_LOGGED_IN" = false ]; then
if [ "$ecr_logged_in" = false ]; then
blue_echo "Logging in to ECR..."
ecr_login_command=$(aws ecr get-login --no-include-email --region $REGISTRY_REGION)
eval $ecr_login_command
ECR_LOGGED_IN=true
ecr_logged_in=true
green_echo "Success\n"
fi
}
@@ -51,66 +51,66 @@ function create_registry() {
### HELPERS ###

function build() {
DIR=$1
IMAGE=$2
TAG=$3
dir=$1
image=$2
tag=$3

blue_echo "Building $IMAGE:$TAG..."
docker build $ROOT -f $DIR/Dockerfile -t cortexlabs/$IMAGE:$TAG -t $REGISTRY_URL/cortexlabs/$IMAGE:$TAG
green_echo "Built $IMAGE:$TAG\n"
blue_echo "Building $image:$tag..."
docker build $ROOT -f $dir/Dockerfile -t cortexlabs/$image:$tag -t $REGISTRY_URL/cortexlabs/$image:$tag
green_echo "Built $image:$tag\n"
}

function build_base() {
DIR=$1
IMAGE=$2
dir=$1
image=$2

blue_echo "Building $IMAGE..."
docker build $ROOT -f $DIR/Dockerfile -t cortexlabs/$IMAGE:latest
green_echo "Built $IMAGE\n"
blue_echo "Building $image..."
docker build $ROOT -f $dir/Dockerfile -t cortexlabs/$image:latest
green_echo "Built $image\n"
}

function cache_builder() {
DIR=$1
IMAGE=$2
dir=$1
image=$2

blue_echo "Building $IMAGE-builder..."
docker build $ROOT -f $DIR/Dockerfile -t cortexlabs/$IMAGE-builder:latest --target builder
green_echo "Built $IMAGE-builder\n"
blue_echo "Building $image-builder..."
docker build $ROOT -f $dir/Dockerfile -t cortexlabs/$image-builder:latest --target builder
green_echo "Built $image-builder\n"
}

function push() {
ecr_login

IMAGE=$1
TAG=$2
image=$1
tag=$2

blue_echo "Pushing $IMAGE:$TAG..."
docker push $REGISTRY_URL/cortexlabs/$IMAGE:$TAG
green_echo "Pushed $IMAGE:$TAG\n"
blue_echo "Pushing $image:$tag..."
docker push $REGISTRY_URL/cortexlabs/$image:$tag
green_echo "Pushed $image:$tag\n"
}

function build_and_push() {
DIR=$1
IMAGE=$2
TAG=$3
dir=$1
image=$2
tag=$3

build $DIR $IMAGE $TAG
push $IMAGE $TAG
build $dir $image $tag
push $image $tag
}

function cleanup() {
docker container prune -f
docker image prune -f
}

CMD=${1:-""}
ENV=${2:-""}
cmd=${1:-""}
env=${2:-""}

if [ "$CMD" = "create" ]; then
if [ "$cmd" = "create" ]; then
create_registry

elif [ "$CMD" = "update" ]; then
if [ "$ENV" != "dev" ]; then
elif [ "$cmd" = "update" ]; then
if [ "$env" != "dev" ]; then
cache_builder $ROOT/images/spark-base spark-base
build_base $ROOT/images/spark-base spark-base
build_base $ROOT/images/tf-base tf-base

0 comments on commit f52bea6

Please sign in to comment.