-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (43 loc) · 1.47 KB
/
Makefile
File metadata and controls
66 lines (43 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash -ec -o pipefail
include INFO
export
##@ Build artifact
.PHONY: prepare
prepare: ## Prepare build
@mkdir -p $(OUTPUT_DIR)
.PHONY: build
build: prepare ## Build artifact
# Zip model
zip -jr $(OUTPUT_FILE) sample
# Render metadata.yml
envsubst < metadata.yml > $(OUTPUT_METADATA)
# Zip file and metadata
zip -j $(OUTPUT_ARCHIVE) $(OUTPUT_FILE) $(OUTPUT_METADATA)
##@ Clean
.PHONY: clean
clean: ## Clean this repository
rm -rf $(OUTPUT_DIR)
##@ Execute artifact
.PHONY: run
run: ## Test your artifact with spark engine using docker
docker run --rm -it \
--entrypoint sparkctl-client \
-v $(CURDIR)/sample:/usr/share/punch/$(DEPENDENCY_LOCATION) \
-v $(CURDIR)/test/punchline.yaml:/data/punchline.yaml \
$(PUNCHLINE_IMG) \
--job /data/punchline.yaml
.PHONY: upload
upload: ## Upload artifact to artifact server
curl -XPOST "$(ARTIFACT_SERVER_UPLOAD_URL)" -F artifact="@$(OUTPUT_ARCHIVE)" -F override=true
.PHONY: apply
apply: ## Apply test punchline to kube
kubectl apply -f test/punchline.yaml
.PHONY: logs
logs: ## View logs of test punchline
kubectl logs -f --tail -1 -l punchline-name=punch-model
.PHONY: delete
delete: ## Delete test punchline
kubectl delete -f test/punchline.yaml --ignore-not-found=true
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*##"; printf "\033[36m\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-28s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)