Update isCurrent status for commit deployments
This commit is contained in:
parent
ac839791bb
commit
d8ac298642
@ -260,19 +260,28 @@ export class Service {
|
|||||||
await Promise.all(deploymentUpdatePromises);
|
await Promise.all(deploymentUpdatePromises);
|
||||||
|
|
||||||
// Get deployments that are in production environment
|
// Get deployments that are in production environment
|
||||||
const prodDeployments = Object.values(recordToDeploymentsMap).filter(deployment => deployment.isCurrent);
|
const prodDeployments = Object.values(recordToDeploymentsMap).filter(
|
||||||
|
(deployment) => deployment.isCurrent,
|
||||||
|
);
|
||||||
// Set the isCurrent state to false for the old deployments
|
// Set the isCurrent state to false for the old deployments
|
||||||
for (const deployment of prodDeployments) {
|
for (const deployment of prodDeployments) {
|
||||||
const projectDeployments = await this.db.getDeploymentsByProjectId(deployment.projectId);
|
const projectDeployments = await this.db.getDeploymentsByProjectId(
|
||||||
const oldDeployments = projectDeployments
|
deployment.projectId,
|
||||||
.filter(projectDeployment => projectDeployment.deployer.deployerLrn === deployment.deployer.deployerLrn && projectDeployment.id !== deployment.id);
|
);
|
||||||
|
const oldDeployments = projectDeployments.filter(
|
||||||
|
(projectDeployment) =>
|
||||||
|
projectDeployment.deployer.deployerLrn ===
|
||||||
|
deployment.deployer.deployerLrn &&
|
||||||
|
projectDeployment.id !== deployment.id &&
|
||||||
|
!deployment.isDNS,
|
||||||
|
);
|
||||||
for (const oldDeployment of oldDeployments) {
|
for (const oldDeployment of oldDeployments) {
|
||||||
await this.db.updateDeployment(
|
await this.db.updateDeployment(
|
||||||
{ id: oldDeployment.id },
|
{ id: oldDeployment.id },
|
||||||
{ isCurrent: false }
|
{ isCurrent: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user