Browse Source

Build(makefile): improve error handling (#17281)

* Build(makefile): improve error handling

Ref baa55ab6ae14ae23864f650cec2bb180b36fdabe
Oleg Gaidarenko 6 năm trước cách đây
mục cha
commit
9ff44b5037
1 tập tin đã thay đổi với 11 bổ sung2 xóa
  1. 11 2
      Makefile

+ 11 - 2
Makefile

@@ -86,16 +86,25 @@ revive: scripts/go/bin/revive
 
 # create docker-compose file with provided sources and start them
 # example: make devenv sources=postgres,openldap
+ifeq ($(sources),)
+devenv:
+	@printf 'You have to define sources for this command \nexample: make devenv sources=postgres,openldap\n'
+else
 devenv: devenv-down
 	$(eval targets := $(shell echo '$(sources)' | tr "," " "))
 
 	@cd devenv; \
-	./create_docker_compose.sh $(targets); \
+	./create_docker_compose.sh $(targets) || \
+	(rm -rf docker-compose.yaml; exit 1)
+
+	@cd devenv; \
 	docker-compose up -d
+endif
 
 # drop down the envs
 devenv-down:
-	@cd devenv; docker-compose down;
+	@cd devenv; \
+	docker-compose down;
 
 # TODO recheck the rules and leave only necessary exclusions
 gosec: scripts/go/bin/gosec