fix(server): revised logic of current and target states
Now, current and target states are now copied from the last
non-published deployment. This is because users can publish older
deployments so looking at the last deployment is not a viable solution.
Fixes
@@ -347,10 +347,17 @@ public class IntegrationHandler extends BaseHandler
builder.deploymentVersion(deployment.getVersion());
}
- // this will effectively set the the integration target/current state to the target/current state of the last deployment
+ if (currentState != IntegrationDeploymentState.Unpublished) {
+ // the bet is that any integration that the user wanted to publish
+ // will have it's status != Unpublished, the reason why we can't
+ // look at the last deployment is because users can choose to deploy
+ // previous deployments, so we bet that all the Unpublished
+ // integrations are not the ones that the user don't hold the
+ // current state
builder.targetState(deployment.getTargetState());
builder.currentState(currentState);
}
+ }
if (deployed != null) {
builder.isDraft(!integration.equals(deployed.getSpec()));
