From c032ea5eee36d137cfd36575e82a643e51db292c Mon Sep 17 00:00:00 2001 From: bandesz Date: Thu, 16 Mar 2017 12:33:06 +0000 Subject: [PATCH] PaaS rollback: check if the rollback app is in a started state --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index b6e72d81c..1d07ff562 100644 --- a/Makefile +++ b/Makefile @@ -295,6 +295,7 @@ cf-check-api-db-migration-task: ## Get the status for the last notify-api-db-mig cf-rollback: ## Rollbacks the app to the previous release $(if ${CF_APP},,$(error Must specify CF_APP)) @cf app --guid ${CF_APP}-rollback || exit 1 + @[ $$(cf curl /v2/apps/`cf app --guid ${CF_APP}-rollback` | jq -r ".entity.state") = "STARTED" ] || (echo "Error: rollback is not possible because ${CF_APP}-rollback is not in a started state" && exit 1) cf delete -f ${CF_APP} || true cf rename ${CF_APP}-rollback ${CF_APP}