Feature Approval Workflow for rollouts (#678)
* implement feature approval workflow Signed-off-by: Ioannis Spyropoulos <ioannis.spyropoulos@bosch-si.com> Signed-off-by: Michael Müller <Michael.Mueller17@bosch-si.com> * add documentation for REST endpoints Signed-off-by: Ioannis Spyropoulos <ioannis.spyropoulos@bosch-si.com> Signed-off-by: Michael Müller <Michael.Mueller17@bosch-si.com> * fix broken documentation test Signed-off-by: Ioannis Spyropoulos <ioannis.spyropoulos@bosch-si.com> * fix broken documentation test II Signed-off-by: Ioannis Spyropoulos <ioannis.spyropoulos@bosch-si.com>
This commit is contained in:
committed by
Dominic Schabel
parent
8a14c931c8
commit
cef7c2bbf2
@@ -340,6 +340,54 @@ public interface RolloutManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE)
|
||||
void resumeRollout(long rolloutId);
|
||||
|
||||
/**
|
||||
* Approves or denies a created rollout being in state
|
||||
* {@link RolloutStatus#WAITING_FOR_APPROVAL}. If the rollout is approved, it
|
||||
* switches state to {@link RolloutStatus#READY}, otherwise it switches to state
|
||||
* {@link RolloutStatus#APPROVAL_DENIED}
|
||||
*
|
||||
* @param rolloutId
|
||||
* the rollout to be approved or denied.
|
||||
* @param decision
|
||||
* decision whether a rollout is approved or denied.
|
||||
*
|
||||
* @return approved or denied rollout
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if rollout with given ID does not exist
|
||||
* @throws RolloutIllegalStateException
|
||||
* if given rollout is not in
|
||||
* {@link RolloutStatus#WAITING_FOR_APPROVAL}. Only rollouts
|
||||
* waiting for approval can be acted upon.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_APPROVE)
|
||||
Rollout approveOrDeny(long rolloutId, Rollout.ApprovalDecision decision);
|
||||
|
||||
/**
|
||||
* Approves or denies a created rollout being in state
|
||||
* {@link RolloutStatus#WAITING_FOR_APPROVAL}. If the rollout is approved, it
|
||||
* switches state to {@link RolloutStatus#READY}, otherwise it switches to state
|
||||
* {@link RolloutStatus#APPROVAL_DENIED}
|
||||
*
|
||||
* @param rolloutId
|
||||
* the rollout to be approved or denied.
|
||||
* @param decision
|
||||
* decision whether a rollout is approved or denied.
|
||||
* @param remark
|
||||
* user remark on approve / deny decision
|
||||
*
|
||||
* @return approved or denied rollout
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* if rollout with given ID does not exist
|
||||
* @throws RolloutIllegalStateException
|
||||
* if given rollout is not in
|
||||
* {@link RolloutStatus#WAITING_FOR_APPROVAL}. Only rollouts
|
||||
* waiting for approveOrDeny can be acted upon.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_APPROVE)
|
||||
Rollout approveOrDeny(long rolloutId, Rollout.ApprovalDecision decision, String remark);
|
||||
|
||||
/**
|
||||
* Starts a rollout which has been created. The rollout must be in
|
||||
* {@link RolloutStatus#READY} state. The Rollout will be set into the
|
||||
|
||||
@@ -25,6 +25,17 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
||||
*/
|
||||
public interface Rollout extends NamedEntity {
|
||||
|
||||
/**
|
||||
* Maximum length of author name.
|
||||
*/
|
||||
int APPROVED_BY_MAX_SIZE = 40;
|
||||
|
||||
|
||||
/**
|
||||
* Maximum length on comment regarding approval decision.
|
||||
*/
|
||||
int APPROVAL_REMARK_MAX_SIZE = 255;
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if the rollout is deleted and only kept for
|
||||
* history purposes.
|
||||
@@ -81,6 +92,16 @@ public interface Rollout extends NamedEntity {
|
||||
*/
|
||||
TotalTargetCountStatus getTotalTargetCountStatus();
|
||||
|
||||
/**
|
||||
* @return user that approved or denied the {@link Rollout}.
|
||||
*/
|
||||
String getApprovalDecidedBy();
|
||||
|
||||
/**
|
||||
* @return additional note on approval/denial decision.
|
||||
*/
|
||||
String getApprovalRemark();
|
||||
|
||||
/**
|
||||
*
|
||||
* State machine for rollout.
|
||||
@@ -93,6 +114,16 @@ public interface Rollout extends NamedEntity {
|
||||
*/
|
||||
CREATING,
|
||||
|
||||
/**
|
||||
* Rollout needs to be approved.
|
||||
*/
|
||||
WAITING_FOR_APPROVAL,
|
||||
|
||||
/**
|
||||
* Rollout approval is denied. Can not be started.
|
||||
*/
|
||||
APPROVAL_DENIED,
|
||||
|
||||
/**
|
||||
* Rollout is ready to start.
|
||||
*/
|
||||
@@ -154,4 +185,18 @@ public interface Rollout extends NamedEntity {
|
||||
ERROR_STARTING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum that holds all possible approval workflow decisions.
|
||||
*/
|
||||
enum ApprovalDecision {
|
||||
/**
|
||||
* Representing an granted approval for a rollout.
|
||||
*/
|
||||
APPROVED,
|
||||
/**
|
||||
* Representing a rejected rollout.
|
||||
*/
|
||||
DENIED
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,6 +114,11 @@ public class TenantConfigurationProperties {
|
||||
*/
|
||||
public static final String ANONYMOUS_DOWNLOAD_MODE_ENABLED = "anonymous.download.enabled";
|
||||
|
||||
/**
|
||||
* Represents setting if approval for a rollout is needed.
|
||||
*/
|
||||
public static final String ROLLOUT_APPROVAL_ENABLED = "rollout.approval.enabled";
|
||||
|
||||
/**
|
||||
* Repository on autoclose mode instead of canceling in case of new DS
|
||||
* assignment over active actions.
|
||||
|
||||
Reference in New Issue
Block a user