Skip to content

Commit

Permalink
Fix pause of rollout on error condition
Browse files Browse the repository at this point in the history
Signed-off-by: TRS1SF3 <[email protected]>
  • Loading branch information
strailov committed Dec 27, 2024
1 parent 4df4e79 commit 9a99651
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,23 @@ public RolloutGroup.RolloutGroupErrorAction getAction() {

@Override
public void exec(final Rollout rollout, final RolloutGroup rolloutG) {

/*
refresh latest rollout state in order to escape cases when
previous group have matched error condition and paused the rollout
and this one tries to pause the rollout too but throws an exception
and rollbacks rollout processing transaction
*/
Rollout refreshedRollout = rolloutManagement.get(rollout.getId()).orElseThrow();
final JpaRolloutGroup rolloutGroup = (JpaRolloutGroup) rolloutG;

systemSecurityContext.runAsSystem(() -> {
rolloutGroup.setStatus(RolloutGroupStatus.ERROR);
rolloutGroupRepository.save(rolloutGroup);
rolloutManagement.pauseRollout(rollout.getId());
if (Rollout.RolloutStatus.PAUSED != refreshedRollout.getStatus()) {
// if only the latest state is != paused then pause
rolloutManagement.pauseRollout(rollout.getId());
}
return null;
});
}
Expand Down

0 comments on commit 9a99651

Please sign in to comment.