From e0dd7007440e46b23c1bb75273b8acf50e0e766f Mon Sep 17 00:00:00 2001 From: dhirsch1 Date: Mon, 4 Sep 2023 13:13:18 +0300 Subject: [PATCH] updated with required changes --- Makefile | 53 +++++----------------------------------------------- Makefile.old | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 5 +++++ 3 files changed, 61 insertions(+), 48 deletions(-) create mode 100644 Makefile.old diff --git a/Makefile b/Makefile index 0f265a4fa..56fb7a02f 100644 --- a/Makefile +++ b/Makefile @@ -1,51 +1,8 @@ -.SILENT: validate docker cluster -validate: +prepare: test -n "$$EMAIL" || (echo "EMAIL is not set. Please set it first."; exit 1) - if ! command which envsubst &> /dev/null; then \ - echo "gettext is not installed. Please install it first."; \ - exit 1; \ - fi - if ! command which minikube &> /dev/null; then \ - echo "minikube is not installed. Please install it first."; \ - exit 1; \ - fi - if ! command which kubectl &> /dev/null; then \ - echo "kubectl is not installed. Please install it first."; \ - exit 1; \ - fi - if ! command which docker &> /dev/null; then \ - echo "docker is not installed. Please install it first."; \ - exit 1; \ - fi - if ! command which md5sum &> /dev/null; then \ - echo "md5sum is not installed. Please install it first."; \ - exit 1; \ - fi - if ! command which mvn &> /dev/null; then \ - echo "maven is not installed. Please install it first."; \ - exit 1; \ - fi -docker: validate - if ! command docker info &> /dev/null; then \ - echo "docker is not running. Please make sure docker is running."; \ - exit 1; \ - fi +build: + ./mvnw package -cluster: docker - if ! command minikube status &> /dev/null; then \ - minikube config set memory 4096; \ - minikube start --driver=docker; \ - fi \ - -build: cluster - mvn install - minikube image build -t petclinic:latest . - -deploy: build - export RANDOM_PART=${EMAIL}_$$(hostname | md5sum | cut -c1-30) && \ - minikube kubectl -- apply -f kube/postgresql.yaml && \ - envsubst < kube/petclinic.yaml | minikube kubectl -- apply -f - - -undeploy: - minikube kubectl -- delete -f kube/ \ No newline at end of file +run: prepare build + java -javaagent:$$HOME/.m2/repository/com/contrastsecurity/contrast-agent/5.2.3/contrast-agent-5.2.3.jar -Dapplication.name=petclinic-${EMAIL} -Dcontrast.config.path=contrast.yaml -jar target/*.jar \ No newline at end of file diff --git a/Makefile.old b/Makefile.old new file mode 100644 index 000000000..0f265a4fa --- /dev/null +++ b/Makefile.old @@ -0,0 +1,51 @@ +.SILENT: validate docker cluster +validate: + test -n "$$EMAIL" || (echo "EMAIL is not set. Please set it first."; exit 1) + if ! command which envsubst &> /dev/null; then \ + echo "gettext is not installed. Please install it first."; \ + exit 1; \ + fi + if ! command which minikube &> /dev/null; then \ + echo "minikube is not installed. Please install it first."; \ + exit 1; \ + fi + if ! command which kubectl &> /dev/null; then \ + echo "kubectl is not installed. Please install it first."; \ + exit 1; \ + fi + if ! command which docker &> /dev/null; then \ + echo "docker is not installed. Please install it first."; \ + exit 1; \ + fi + if ! command which md5sum &> /dev/null; then \ + echo "md5sum is not installed. Please install it first."; \ + exit 1; \ + fi + if ! command which mvn &> /dev/null; then \ + echo "maven is not installed. Please install it first."; \ + exit 1; \ + fi + +docker: validate + if ! command docker info &> /dev/null; then \ + echo "docker is not running. Please make sure docker is running."; \ + exit 1; \ + fi + +cluster: docker + if ! command minikube status &> /dev/null; then \ + minikube config set memory 4096; \ + minikube start --driver=docker; \ + fi \ + +build: cluster + mvn install + minikube image build -t petclinic:latest . + +deploy: build + export RANDOM_PART=${EMAIL}_$$(hostname | md5sum | cut -c1-30) && \ + minikube kubectl -- apply -f kube/postgresql.yaml && \ + envsubst < kube/petclinic.yaml | minikube kubectl -- apply -f - + +undeploy: + minikube kubectl -- delete -f kube/ \ No newline at end of file diff --git a/pom.xml b/pom.xml index ce92ea579..87223f383 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,11 @@ + + com.contrastsecurity + contrast-agent + 5.2.3 + org.springframework.boot spring-boot-starter-actuator