Remove also if no zone
@@ -382,9 +382,9 @@ public class ApplicationController {
private Application deleteUnreferencedDeploymentJobs(Application application) {
for (DeploymentJobs.JobType job : application.deploymentJobs().jobStatus().keySet()) {
Optional<Zone> zone = job.zone(controller.system());
- if ( ! zone.isPresent()) continue;
- if ( ! application.deploymentSpec().includes(zone.get().environment(), zone.map(Zone::region)))
+ if ( ! job.isProduction() || (zone.isPresent() && application.deploymentSpec().includes(zone.get().environment(), zone.map(Zone::region))))
+ continue;
application = application.withoutDeploymentJob(job);
}
return application;
