Auto DevOps doesn't check for deployment before scaling it

Problem

Auto DevOps tries to scale a deployment when doing incremental rollouts. Specifically, it targets the production deployment in order to keep the correct number of REPLICAS.

The problem raises when there is no production deployment. For example, the first deployment of a project.

This leads to an error:

$ scale stable $((100-ROLLOUT_PERCENTAGE))
Error: UPGRADE FAILED: release: "production" not found
ERROR: Job failed: exit code 1

Solution

Check if a deployment exists before scaling it.