ptut-virtenv/Makefile

62 lines
2.3 KiB
Makefile
Executable File

start:
@test "`docker-compose ps | wc -l`" -le "2" || (echo -e "/!\\ already running environment\n"; exit 1);
@echo "> [1] pre-start script";
@bash ./metactl/pre-start.sh && echo "< done" || (echo "< failed"; exit 1);
@echo;
@echo "> [2] Build & launch environment";
@docker-compose up -d > /dev/null 2>&1 && echo "< done" || (echo "< failed"; exit 1);
@echo;
@echo "> [3] post-start script";
@bash ./metactl/post-start.sh && echo "< done" || (echo "< failed"; exit 1);
start-no-cache:
@test "`docker-compose ps | wc -l`" -le "2" || (echo -e "/!\\ already running environment\n"; exit 1);
@echo "> [1] pre-start script";
@bash ./metactl/pre-start.sh && echo "< done" || (echo "< failed"; exit 1);
@echo;
@echo "> [2] Build & launch environment";
@docker-compose up -d --build > /dev/null 2>&1 && echo "< done" || (echo "< failed"; exit 1);
@echo;
@echo "> [3] post-start script";
@bash ./metactl/post-start.sh && echo "< done" || (echo "< failed"; exit 1);
stop:
@test "`docker-compose ps | wc -l`" -gt "2" || (echo -e "/!\\ no running environment\n"; exit 1);
@echo "> [1] pre-stop script";
@bash ./metactl/pre-stop.sh && echo "< done" || (echo "< failed"; exit 1);
@echo;
@echo "> [2] Stop and remove environment";
@docker-compose down --remove-orphans > /dev/null 2>&1 && echo "< done" || (echo "< failed"; exit 1);
@echo;
@echo "> [3] post-stop script";
@bash ./metactl/post-stop.sh && echo "< done" || (echo "< failed"; exit 1);
ci:
@echo "*************************";
@echo "* *";
@echo "* Launching CI loop *";
@echo "* *";
@echo "*************************";
@echo;
@echo -n "*** Create trigger.............";
@test ! -d ./virtual/ci && mkdir ./virtual/ci; (exit 0);
@chmod 777 ./virtual/ci; (exit 0);
@touch ./virtual/ci/trigger; echo "done";
@chmod 777 ./virtual/ci/trigger; (exit 0);
@echo;
@echo "*** Launch environment.........launching";
@make start | sed 's/^\(.\)/\t\1/g' || (exit 1);
@echo;
@echo "*** Wait for trigger...........waiting";
@while [ -f ./virtual/ci/trigger ]; do sleep 1; done;
@echo;
@echo "*** Remove environment.........removing";
@make stop;
@echo;
@echo -n "*** Update source..............";
@git pull origin master > /dev/null 2>&1 && echo "updated" || echo "failed";
@echo;
@echo "*** Launch CI loop again";
@make ci;