code: private boolean redundantUndeployment(final Deployment deployment,
                                          final DeploymentGroup deploymentGroup) {
      // This deployment was not created by this deployment group.
      if (!Objects.equals(deployment.getDeploymentGroupName(), deploymentGroup.getName())) {
        return false;
      }
  
      // This deployment is not of the deployment group's job.
      if (!deployment.getJobId().equals(deploymentGroup.getJobId())) {
        return false;
      }
  
      // This deployment aims to do something other than start.
      if (!Goal.START.equals(deployment.getGoal())) {
        return false;
      }
  
      // Undeploying this deployment's job would be redundant because the next operation would simply
      // redeploy the same job.
      return true;
    }
docs: redundantDeployment determines whether or not rollingUpdateUndeploy should actually emit
  RollingUpdateOps to undeploy a job.
  
  <p>Jobs are undeployed in two cases:
  
  <p>1. During a rolling update
  2. When a host leaves a deployment group
  
  <p>In case 1. this redundancy check makes sense. The undeployment of a job during a rolling
  update is always coupled with the deployment of a job. If the 'new' job is the same job
  that is currently deployed, the undeployment would be redundant so we do not generate
  deployment operations.
  
  <p>In case 2. undeployment can never be redundant. We always want to undeploy the job from
  hosts that have left the deployment group. Unfortunately in case case undeployments appear to
  be redundant to the following checks, so they must be skipped.