diff --git a/runner/cf-driver/cleanup.sh b/runner/cf-driver/cleanup.sh index 1f9926e..68331f9 100755 --- a/runner/cf-driver/cleanup.sh +++ b/runner/cf-driver/cleanup.sh @@ -57,9 +57,13 @@ cleanup_services () { done } -cleanup_services "$CONTAINER_ID" "$CUSTOM_ENV_CI_JOB_SERVICES" - -echo "[cf-driver] Deleting executor instance $CONTAINER_ID" -cf delete -f "$CONTAINER_ID" +if [ -z "$CUSTOM_ENV_PRESERVE_SERVICES" ]; then + cleanup_services "$CONTAINER_ID" "$CUSTOM_ENV_CI_JOB_SERVICES" +fi + +if [ -z "$CUSTOM_ENV_PRESERVE_WORKER" ]; then + echo "[cf-driver] Deleting executor instance $CONTAINER_ID" + cf delete -f "$CONTAINER_ID" +fi echo "[cf-driver] Cleanup completed for $CONTAINER_ID"