summaryrefslogtreecommitdiffstats
path: root/pnda-ztt-app/Makefile
blob: 69226cce14a634429005b72650a740a257e3e599 (plain)
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
SERVER=https://knox.example.com:8443/gateway/pnda/repository
APP=src/universal/sparkStreaming/PndaZTTApp/PndaZTTApp.jar
PACKAGE=pnda-ztt-app-0.0.4.tar.gz
DEBUG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

app:		## Build the application jar
	sbt assembly

package:	## Build the deployable package
	sbt 'universal:packageZipTarball'

deploy:		## Deploy the package to PNDA cluster
	curl -k -u pnda:pnda -X PUT $(SERVER)/packages/ --upload-file target/universal/$(PACKAGE) > /dev/null

list:		## Show the deployed packages
	curl $(SERVER)/packages

delete:		## Delete the deployed package
	curl -k -u pnda:pnda -XDELETE $(SERVER)/packages/$(PACKAGE)

test/PndaZTTApp.jar:	$(APP) test/application.properties
	cp $< $@
	jar uvf $@ -C test application.properties

test:	test/PndaZTTApp.jar	## Run the assembly with spark-submit
	spark-submit \
		--driver-java-options "-Dlog4j.configuration=file://$(PWD)/test/log4j.testing.properties" \
		--class com.cisco.ztt.App \
		--master 'local[4]' --deploy-mode client \
		test/PndaZTTApp.jar

clean:		## Run sbt clean
	sbt clean
	rm -f $(APP)
	rm -f test/PndaZTTApp.jar

help:		## This help
	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

.PHONY: help test
.DEFAULT_GOAL := help