Backport deployments conditional logic from exp branch, at a9f2affd