Feature offline deployments (#563)
* Repository support offline deployments. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Add offline assignment to Management API. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * DsAssignmentStrategy introduced. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fixed JavaDoc. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Readibility improved. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import java.util.Optional;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.IncompleteDistributionSetException;
|
||||
@@ -28,6 +29,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -69,7 +71,6 @@ public interface DeploymentManagement {
|
||||
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID, @NotNull ActionType actionType,
|
||||
long forcedTimestamp, @NotEmpty Collection<String> controllerIDs);
|
||||
|
||||
|
||||
/**
|
||||
* method assigns the {@link DistributionSet} to all {@link Target}s by
|
||||
* their IDs with a specific {@link ActionType} and {@code forcetime}.
|
||||
@@ -116,6 +117,38 @@ public interface DeploymentManagement {
|
||||
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID,
|
||||
@NotEmpty Collection<TargetWithActionType> targets, String actionMessage);
|
||||
|
||||
/**
|
||||
* Method registers an "offline" assignment, i.e. adds a completed action
|
||||
* for the given {@link DistributionSet} to the given {@link Target}s.
|
||||
*
|
||||
* The handling differs to hawkBit managed updates my means that:<br/>
|
||||
*
|
||||
* <ol type="A">
|
||||
* <li>it ignores targets completely that are in
|
||||
* {@link TargetUpdateStatus#PENDING}.</li>
|
||||
* <li>it creates completed actions.</li>
|
||||
* <li>sets both installed and assigned DS on the target and switches the
|
||||
* status to {@link TargetUpdateStatus#IN_SYNC}.</li>
|
||||
* <li>does not send a {@link TargetAssignDistributionSetEvent}.</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param dsID
|
||||
* the ID of the distribution set that was assigned
|
||||
* @param controllerIDs
|
||||
* a list of IDs of the targets that where assigned
|
||||
* @return the assignment result
|
||||
*
|
||||
* @throws IncompleteDistributionSetException
|
||||
* if mandatory {@link SoftwareModuleType} are not assigned as
|
||||
* defined by the {@link DistributionSetType}.
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if either provided {@link DistributionSet} or {@link Target}s
|
||||
* do not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
DistributionSetAssignmentResult offlineAssignedDistributionSet(Long dsID, Collection<String> controllerIDs);
|
||||
|
||||
/**
|
||||
* Cancels given {@link Action} for given {@link Target}. The method will
|
||||
* immediately add a {@link Status#CANCELED} status to the action. However,
|
||||
|
||||
Reference in New Issue
Block a user