Multi-Asssignments feature removal (#2893)

* Multi-Asssignments feature removal

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* fix some sonar findings

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* fixes after review

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

---------

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
Stanislav Trailov
2026-02-04 16:59:09 +02:00
committed by GitHub
parent 2bf443661d
commit c33156b134
43 changed files with 123 additions and 1610 deletions

View File

@@ -32,7 +32,7 @@ import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.IncompleteDistributionSetException;
import org.eclipse.hawkbit.repository.exception.MultiAssignmentIsNotEnabledException;
import org.eclipse.hawkbit.repository.exception.MultiAssignmentException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
import org.eclipse.hawkbit.repository.model.Action;
@@ -76,8 +76,8 @@ public interface DeploymentManagement extends PermissionSupport {
* @throws EntityNotFoundException if either provided {@link DistributionSet} or {@link Target}s do not exist
* @throws AssignmentQuotaExceededException if the maximum number of targets the distribution set can be
* assigned to at once is exceeded
* @throws MultiAssignmentIsNotEnabledException if the request results in multiple assignments to the same
* target and multi-assignment is disabled
* @throws MultiAssignmentException if the request results in multiple assignments to the same
* target
*/
@PreAuthorize(HAS_UPDATE_TARGET_AND_READ_DISTRIBUTION_SET)
List<DistributionSetAssignmentResult> assignDistributionSets(
@@ -102,8 +102,8 @@ public interface DeploymentManagement extends PermissionSupport {
* defined by the {@link DistributionSetType}.
* @throws EntityNotFoundException if either provided {@link DistributionSet} or {@link Target}s do not exist
* @throws AssignmentQuotaExceededException if the maximum number of targets the distribution set can be assigned to at once is exceeded
* @throws MultiAssignmentIsNotEnabledException if the request results in multiple assignments to the same
* target and multi-assignment is disabled
* @throws MultiAssignmentException if the request results in multiple assignments to the same
* target
*/
@PreAuthorize(HAS_UPDATE_TARGET_AND_READ_DISTRIBUTION_SET)
List<DistributionSetAssignmentResult> offlineAssignedDistributionSets(Collection<Entry<String, Long>> assignments);

View File

@@ -1,40 +0,0 @@
/**
* Copyright (c) 2020 Bosch.IO GmbH and others
*
* 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.event.remote;
import java.io.Serial;
import java.util.List;
import lombok.NoArgsConstructor;
import org.eclipse.hawkbit.repository.model.Action;
/**
* Generic deployment event for the Multi-Assignments feature. The event extends
* the {@link MultiActionEvent} and holds a list of controller IDs to identify
* the targets which are affected by a deployment action and a list of
* actionIds containing the identifiers of the affected actions
* as payload. This event is only published in case of an assignment.
*/
@NoArgsConstructor
public class MultiActionAssignEvent extends MultiActionEvent {
@Serial
private static final long serialVersionUID = 1L;
/**
* Constructor.
*
* @param tenant tenant the event is scoped to
* @param actions the actions of the deployment action
*/
public MultiActionAssignEvent(String tenant, List<Action> actions) {
super(tenant, actions);
}
}

View File

@@ -1,32 +0,0 @@
/**
* Copyright (c) 2020 Bosch.IO GmbH and others
*
* 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.event.remote;
import java.io.Serial;
import java.util.List;
import lombok.NoArgsConstructor;
import org.eclipse.hawkbit.repository.model.Action;
/**
* Generic deployment event for the Multi-Assignments feature. The event extends the {@link MultiActionEvent} and holds a list of controller IDs
* to identify the targets which are affected by a deployment action and a list of actionIds containing the identifiers of the affected actions
* as payload. This event is only published in case of a cancellation.
*/
@NoArgsConstructor // for serialization libs like jackson
public class MultiActionCancelEvent extends MultiActionEvent {
@Serial
private static final long serialVersionUID = 1L;
public MultiActionCancelEvent(String tenant, List<Action> actions) {
super(tenant, actions);
}
}

View File

@@ -1,62 +0,0 @@
/**
* Copyright (c) 2019 Bosch Software Innovations GmbH and others
*
* 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.event.remote;
import java.io.Serial;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.ToString;
import org.eclipse.hawkbit.repository.Identifiable;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Target;
/**
* Generic deployment event for the Multi-Assignments feature. The event payload holds a list of controller IDs identifying the targets which
* are affected by a deployment action (e.g. a software assignment (update) or a cancellation of an update).
*/
@NoArgsConstructor(access = AccessLevel.PROTECTED) // for serialization libs like jackson
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public abstract class MultiActionEvent extends RemoteTenantAwareEvent implements Iterable<String> {
@Serial
private static final long serialVersionUID = 1L;
private final List<String> controllerIds = new ArrayList<>();
private final List<Long> actionIds = new ArrayList<>();
protected MultiActionEvent(final String tenant, final List<Action> actions) {
super(tenant, null);
this.controllerIds.addAll(getControllerIdsFromActions(actions));
this.actionIds.addAll(getIdsFromActions(actions));
}
@Override
@NonNull
public Iterator<String> iterator() {
return controllerIds.iterator();
}
private static List<String> getControllerIdsFromActions(final List<Action> actions) {
return actions.stream().map(Action::getTarget).map(Target::getControllerId).distinct().toList();
}
private static List<Long> getIdsFromActions(final List<Action> actions) {
return actions.stream().map(Identifiable::getId).toList();
}
}

View File

@@ -1,31 +0,0 @@
/**
* 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.event.remote.service;
import java.io.Serial;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.eclipse.hawkbit.repository.event.remote.MultiActionAssignEvent;
/**
* Service event for {@link MultiActionAssignEvent}. Event that needs single replica processing
*/
public class MultiActionAssignServiceEvent extends AbstractServiceRemoteEvent<MultiActionAssignEvent> {
@Serial
private static final long serialVersionUID = 1L;
@JsonCreator
public MultiActionAssignServiceEvent(@JsonProperty("payload") final MultiActionAssignEvent remoteEvent) {
super(remoteEvent);
}
}

View File

@@ -1,31 +0,0 @@
/**
* 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.event.remote.service;
import java.io.Serial;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.eclipse.hawkbit.repository.event.remote.MultiActionCancelEvent;
/**
* Service event for {@link MultiActionCancelEvent}. Event that needs single replica processing
*/
public class MultiActionCancelServiceEvent extends AbstractServiceRemoteEvent<MultiActionCancelEvent> {
@Serial
private static final long serialVersionUID = 1L;
@JsonCreator
public MultiActionCancelServiceEvent(@JsonProperty("payload") final MultiActionCancelEvent remoteEvent) {
super(remoteEvent);
}
}

View File

@@ -21,14 +21,14 @@ import org.eclipse.hawkbit.exception.SpServerError;
*/
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MultiAssignmentIsNotEnabledException extends AbstractServerRtException {
public class MultiAssignmentException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_MULTIASSIGNMENT_NOT_ENABLED;
private static final SpServerError THIS_ERROR = SpServerError.SP_MULTIASSIGNMENT;
public MultiAssignmentIsNotEnabledException() {
public MultiAssignmentException() {
super(THIS_ERROR);
}
}

View File

@@ -10,7 +10,6 @@
package org.eclipse.hawkbit.repository.helper;
import static org.eclipse.hawkbit.context.AccessContext.asSystem;
import static org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey.MULTI_ASSIGNMENTS_ENABLED;
import static org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey.USER_CONFIRMATION_FLOW_ENABLED;
import java.io.Serializable;
@@ -45,10 +44,6 @@ public final class TenantConfigHelper {
return asSystem(() -> getTenantConfigurationManagement().getConfigurationValue(key, valueType).getValue());
}
public static boolean isMultiAssignmentsEnabled() {
return getAsSystem(MULTI_ASSIGNMENTS_ENABLED, Boolean.class);
}
public static boolean isUserConfirmationFlowEnabled() {
return getAsSystem(USER_CONFIRMATION_FLOW_ENABLED, Boolean.class);
}

View File

@@ -116,10 +116,6 @@ public class TenantConfigurationProperties {
* Configuration value for percentage of oldest actions to be cleaned if @maxActionsPerTarget quota is hit
*/
public static final String ACTION_CLEANUP_ON_QUOTA_HIT_PERCENTAGE = "action.cleanup.onQuotaHit.percent";
/**
* Switch to enable/disable the multi-assignment feature.
*/
public static final String MULTI_ASSIGNMENTS_ENABLED = "multi.assignments.enabled";
/**
* Switch to enable/disable the batch-assignment feature.
*/