Introduce Stop of a rollout (#2595)
* Stop of a rollout feature Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * remove some test comments Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * make stop transactional Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * attempt to fix hibernate failed tests Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * fix some sonar issues Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * changes after review Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * fix build Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * fixes after review Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * finish all rollout groups on deletion of rollout Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * refactor finishing groups Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * fix RolloutManagementTest Signed-off-by: strailov <Stanislav.Trailov@bosch.io> --------- Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
committed by
GitHub
parent
4566702030
commit
45cd012532
@@ -31,12 +31,12 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.ActionCancellationType;
|
||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
import org.eclipse.hawkbit.repository.model.DeploymentRequest;
|
||||
import org.eclipse.hawkbit.repository.model.DeploymentRequestBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetInvalidation.CancelationType;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
@@ -421,5 +421,5 @@ public interface DeploymentManagement extends PermissionSupport {
|
||||
* @param set the distribution set for that the actions should be canceled
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void cancelActionsForDistributionSet(final CancelationType cancelationType, final DistributionSet set);
|
||||
void cancelActionsForDistributionSet(final ActionCancellationType cancelationType, final DistributionSet set);
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.ActionCancellationType;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
@@ -354,6 +355,14 @@ public interface RolloutManagement extends PermissionSupport {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
Rollout update(@NotNull @Valid Update update);
|
||||
|
||||
/**
|
||||
* Stop a rollout
|
||||
* @param rolloutId of the rollout to be stopped
|
||||
* @return stopped rollout
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
Rollout stop(long rolloutId);
|
||||
|
||||
/**
|
||||
* Deletes a rollout. A rollout might be deleted asynchronously by
|
||||
* indicating the rollout by {@link RolloutStatus#DELETING}
|
||||
@@ -372,7 +381,7 @@ public interface RolloutManagement extends PermissionSupport {
|
||||
* canceled
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void cancelRolloutsForDistributionSet(DistributionSet set);
|
||||
void cancelRolloutsForDistributionSet(DistributionSet set, ActionCancellationType cancelationType);
|
||||
|
||||
/**
|
||||
* Triggers next group of a rollout for processing even success threshold
|
||||
@@ -385,6 +394,15 @@ public interface RolloutManagement extends PermissionSupport {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void triggerNextGroup(long rolloutId);
|
||||
|
||||
/**
|
||||
* Cancels all actions that refer to a given rollout.
|
||||
*
|
||||
* @param cancelationType - type of cancellation - FORCE or SOFT (NONE is ignored)
|
||||
* @param rollout - the rollout which actions are about to be cancelled
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_UPDATE_REPOSITORY)
|
||||
void cancelActiveActionsForRollouts(final Rollout rollout, final ActionCancellationType cancelationType);
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Contributors to the Eclipse Foundation
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
/**
|
||||
* Defines if and how actions should be canceled when :
|
||||
* - invalidating a distribution set
|
||||
* - stopping a rollout
|
||||
* - deleting a rollout
|
||||
*/
|
||||
public enum ActionCancellationType {
|
||||
/**
|
||||
* will perform a FORCE action cancellation - will put them in CANCELED state.
|
||||
*/
|
||||
FORCE,
|
||||
|
||||
/**
|
||||
* will perform a SOFT action cancellation - will put them in CANCELING state.
|
||||
*/
|
||||
SOFT,
|
||||
|
||||
/**
|
||||
* Used in distribution set invalidation - will ONLY invalidate the DS, will not change action status
|
||||
*/
|
||||
NONE
|
||||
}
|
||||
@@ -20,28 +20,16 @@ import lombok.Data;
|
||||
public class DistributionSetInvalidation {
|
||||
|
||||
private Collection<Long> distributionSetIds;
|
||||
private CancelationType cancelationType;
|
||||
private boolean cancelRollouts;
|
||||
private ActionCancellationType actionCancellationType;
|
||||
|
||||
/**
|
||||
* Parametric constructor
|
||||
*
|
||||
* @param distributionSetIds defines which distribution sets should be canceled
|
||||
* @param cancelationType defines if actions should be canceled
|
||||
* @param cancelRollouts defines if rollouts should be canceled
|
||||
* @param actionCancellationType defines if actions should be canceled
|
||||
*/
|
||||
public DistributionSetInvalidation(final Collection<Long> distributionSetIds, final CancelationType cancelationType,
|
||||
final boolean cancelRollouts) {
|
||||
public DistributionSetInvalidation(final Collection<Long> distributionSetIds, final ActionCancellationType actionCancellationType) {
|
||||
this.distributionSetIds = distributionSetIds;
|
||||
this.cancelationType = cancelationType;
|
||||
this.cancelRollouts = cancelRollouts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if and how actions should be canceled when invalidating a
|
||||
* distribution set
|
||||
*/
|
||||
public enum CancelationType {
|
||||
FORCE, SOFT, NONE
|
||||
this.actionCancellationType = actionCancellationType;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user