Skip to content

Commit afeb169

Browse files
authored
Update Makefile (#19)
1 parent 5176e05 commit afeb169

File tree

5 files changed

+83
-109
lines changed

5 files changed

+83
-109
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
---
33
Checklist:
4-
- [ ] Run automated tests (`./build/test.sh`)
4+
- [ ] Run automated tests (`make test`)
55
- [ ] Test end to end manually (e.g. rebuild registry/operator and run `cx refresh` in an example folder)
66
- [ ] Add license header to each new file
77
- [ ] Update documentation

Makefile

Lines changed: 69 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,31 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
###############
16-
# Dev Helpers #
17-
###############
1815
SHELL := /bin/bash
19-
GOBIN ?= $$PWD/bin
20-
GOOS ?=
21-
define build
22-
mkdir -p $(GOBIN) && \
23-
GOOS=$(GOOS) \
24-
GOARCH=amd64 \
25-
CGO_ENABLED=0 \
26-
GOBIN=$(GOBIN) \
27-
GO111MODULE=on \
28-
go install -v \
29-
-gcflags='-e' \
30-
$(1)
31-
endef
32-
33-
34-
############
35-
# Operator #
36-
############
37-
olocal:
38-
@./dev/operator_local.sh
3916

40-
ostop:
41-
@kubectl -n=cortex delete --ignore-not-found=true deployment operator
17+
#######
18+
# Dev #
19+
#######
4220

43-
oupdate:
44-
@./cortex.sh -c=./dev/config/cortex.sh update operator
21+
# Operator
22+
23+
olocal:
24+
@./dev/operator_local.sh || true
4525

4626
oinstall:
4727
@./cortex.sh -c=./dev/config/cortex.sh install operator
4828

29+
oupdate:
30+
@./cortex.sh -c=./dev/config/cortex.sh update operator
31+
4932
ouninstall:
5033
@./cortex.sh -c=./dev/config/cortex.sh uninstall operator
5134

35+
ostop:
36+
@kubectl -n=cortex delete --ignore-not-found=true deployment operator
37+
38+
# EKS
5239

53-
#######
54-
# EKS #
55-
#######
5640
eks-up:
5741
@./dev/eks.sh start
5842
$(MAKE) oinstall
@@ -68,117 +52,102 @@ eks-down:
6852
eks-set:
6953
@./dev/eks.sh set
7054

71-
########
72-
# KOPS #
73-
########
55+
# KOPS
56+
7457
kops-up:
7558
@./dev/kops.sh start
7659
$(MAKE) oinstall
77-
60+
7861
kops-up-dev:
7962
$(MAKE) kops-up
8063
$(MAKE) ostop
81-
64+
8265
kops-down:
8366
@./dev/kops.sh stop
8467

8568
kops-set:
8669
@./dev/kops.sh set
8770

88-
##############
89-
# Misc stuff #
90-
##############
91-
92-
tools:
93-
@go get -u -v github.com/VojtechVitek/rerun/cmd/rerun
94-
@curl -fLSs https://circle.ci/cli | bash
95-
96-
build-cli:
97-
@$(call build, ./cli)
98-
99-
test:
100-
@./build/test.sh
71+
# Docker images
10172

10273
registry-all:
10374
@./dev/registry.sh update
10475

10576
registry-dev:
106-
@./dev/registry.sh update dev
77+
@./dev/registry.sh update dev
78+
79+
registry-create:
80+
@./dev/registry.sh create
81+
82+
# Misc
83+
84+
.PHONY: cli
85+
cli:
86+
@mkdir -p ./bin
87+
@GOARCH=amd64 CGO_ENABLED=0 go build -o ./bin/cortex ./cli
10788

10889
find-missing-license:
10990
@./build/find-missing-license.sh
11091

11192
find-missing-version:
11293
@./build/find-missing-version.sh
113-
94+
95+
aws-clear-bucket:
96+
@./dev/aws.sh clear-bucket
97+
98+
tools:
99+
@go get -u -v github.com/VojtechVitek/rerun/cmd/rerun
100+
@curl -fLSs https://circle.ci/cli | bash
101+
102+
#########
103+
# Tests #
104+
#########
105+
106+
test:
107+
@./build/test.sh
108+
109+
test-go:
110+
@./build/test.sh go
111+
112+
test-python:
113+
@./build/test.sh python
114114

115115
###############
116116
# CI Commands #
117117
###############
118-
build-spark-base:
119-
@docker build . -f images/spark-base/Dockerfile -t cortexlabs/spark-base:latest
120-
121-
build-tf-base:
122-
@docker build . -f images/tf-base/Dockerfile -t cortexlabs/tf-base:latest
123-
@docker build . -f images/tf-base-gpu/Dockerfile -t cortexlabs/tf-base-gpu:latest
124-
125-
build-base: spark-base tf-base
126118

127-
build-tf-dev:
119+
build-images:
120+
@./build/build-image.sh images/spark-base spark-base
121+
@./build/build-image.sh images/tf-base tf-base
122+
@./build/build-image.sh images/tf-base-gpu tf-base-gpu
123+
@./build/build-image.sh images/spark spark
124+
@./build/build-image.sh images/spark-operator spark-operator
128125
@./build/build-image.sh images/tf-train tf-train
129-
@./build/build-image.sh images/tf-serve tf-serve
130-
@./build/build-image.sh images/tf-api tf-api
131126
@./build/build-image.sh images/tf-train-gpu tf-train-gpu
127+
@./build/build-image.sh images/tf-serve tf-serve
132128
@./build/build-image.sh images/tf-serve-gpu tf-serve-gpu
133-
134-
build-spark-dev:
135-
@./build/build-image.sh images/spark spark
136-
@./build/build-image.sh images/spark-operator spark-operator
137-
138-
build-tf-images: build-tf-base build-tf-dev
139-
build-spark-images: build-spark-base build-spark-dev
140-
141-
build-argo-images:
142-
@./build/build-image.sh images/argo-controller argo-controller
143-
@./build/build-image.sh images/argo-executor argo-executor
144-
145-
build-operator-images:
129+
@./build/build-image.sh images/tf-api tf-api
146130
@./build/build-image.sh images/operator operator
131+
@./build/build-image.sh images/fluentd fluentd
147132
@./build/build-image.sh images/nginx-controller nginx-controller
148133
@./build/build-image.sh images/nginx-backend nginx-backend
149-
@./build/build-image.sh images/fluentd fluentd
150-
151-
build-images: build-tf-images build-spark-images build-argo-images build-operator-images
134+
@./build/build-image.sh images/argo-controller argo-controller
135+
@./build/build-image.sh images/argo-executor argo-executor
152136

153-
push-tf-images:
137+
push-images:
138+
@./build/push-image.sh spark
139+
@./build/push-image.sh spark-operator
154140
@./build/push-image.sh tf-train
155-
@./build/push-image.sh tf-serve
156-
@./build/push-image.sh tf-api
157141
@./build/push-image.sh tf-train-gpu
142+
@./build/push-image.sh tf-serve
158143
@./build/push-image.sh tf-serve-gpu
159-
160-
push-spark-images:
161-
@./build/push-image.sh spark
162-
@./build/push-image.sh spark-operator
163-
164-
push-argo-images:
165-
@./build/push-image.sh argo-controller
166-
@./build/push-image.sh argo-executor
167-
168-
push-operator-images:
144+
@./build/push-image.sh tf-api
169145
@./build/push-image.sh operator
146+
@./build/push-image.sh fluentd
170147
@./build/push-image.sh nginx-controller
171148
@./build/push-image.sh nginx-backend
172-
@./build/push-image.sh fluentd
173-
174-
push-images: push-tf-images push-spark-images push-argo-images push-operator-images
149+
@./build/push-image.sh argo-controller
150+
@./build/push-image.sh argo-executor
175151

176152
build-and-upload-cli:
177153
@./build/cli.sh
178-
179-
test-go:
180-
@./build/test.sh go
181-
182-
test-python:
183-
@./build/test.sh python
184-

build/cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function build_and_upload() {
2323
set -euo pipefail
2424

2525
os=$1
26-
GOOS=$os GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build -installsuffix cgo -o cortex github.com/cortexlabs/cortex/cli
26+
GOOS=$os GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build -o cortex github.com/cortexlabs/cortex/cli
2727
aws s3 cp cortex s3://$CLI_BUCKET_NAME/$CORTEX_VERSION/cli/$os/cortex --only-show-errors
2828
rm cortex
2929
echo "Uploaded CLI to s3://$CLI_BUCKET_NAME/$CORTEX_VERSION/cli/$os/cortex"

build/find-missing-version.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
output=$(grep --exclude="find-missing-version.sh" -R -A 50 -e "CORTEX_VERSION" . | grep -e "master")
17+
output=$(find . -type f \
18+
! -path "./vendor/*" \
19+
! -path "./bin/*" \
20+
! -path "./build/find-missing-version.sh" \
21+
! -path "./.git/*" \
22+
! -name ".*" \
23+
-exec grep -R -A 50 -e "CORTEX_VERSION" {} \+)
24+
25+
output=$(echo "$output" | grep -e "master")
1826

1927
if [[ $output ]]; then
2028
echo "$output"
2129
exit 1
2230
fi
23-

dev/aws.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null && pwd)"
2121

2222
source $ROOT/dev/config/build.sh
2323
source $ROOT/dev/config/k8s.sh
24+
source $ROOT/dev/config/cortex.sh
2425
source $ROOT/dev/util.sh
2526

26-
if [ "$1" = "delete-cache" ]; then
27-
aws s3 rm --recursive --quiet s3://$K8S_BUCKET/apps
28-
aws s3 rm --recursive --quiet s3://$K8S_BUCKET/contexts
29-
aws s3 rm --recursive --quiet s3://$K8S_BUCKET/model_implementations
30-
aws s3 rm --recursive --quiet s3://$K8S_BUCKET/transformations
27+
if [ "$1" = "clear-bucket" ]; then
28+
aws s3 rm --recursive --quiet s3://$CORTEX_BUCKET
3129
else
3230
echo "Command $1 not found"
3331
fi

0 commit comments

Comments
 (0)