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
@@ -59,12 +59,14 @@ public abstract class AbstractRolloutManagement implements RolloutManagement {
|
||||
|
||||
protected final LockRegistry lockRegistry;
|
||||
|
||||
protected final RolloutApprovalStrategy rolloutApprovalStrategy;
|
||||
|
||||
protected AbstractRolloutManagement(final TargetManagement targetManagement,
|
||||
final DeploymentManagement deploymentManagement, final RolloutGroupManagement rolloutGroupManagement,
|
||||
final DistributionSetManagement distributionSetManagement, final ApplicationContext context,
|
||||
final ApplicationEventPublisher eventPublisher, final VirtualPropertyReplacer virtualPropertyReplacer,
|
||||
final PlatformTransactionManager txManager, final TenantAware tenantAware,
|
||||
final LockRegistry lockRegistry) {
|
||||
final LockRegistry lockRegistry, final RolloutApprovalStrategy rolloutApprovalStrategy) {
|
||||
this.targetManagement = targetManagement;
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
this.rolloutGroupManagement = rolloutGroupManagement;
|
||||
@@ -75,6 +77,7 @@ public abstract class AbstractRolloutManagement implements RolloutManagement {
|
||||
this.txManager = txManager;
|
||||
this.tenantAware = tenantAware;
|
||||
this.lockRegistry = lockRegistry;
|
||||
this.rolloutApprovalStrategy = rolloutApprovalStrategy;
|
||||
}
|
||||
|
||||
protected Long runInNewTransaction(final String transactionName, final TransactionCallback<Long> action) {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright (c) 2018 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
|
||||
/**
|
||||
* This interface provides methods to enable plugging in of different strategies
|
||||
* to handle rollout approval.
|
||||
*/
|
||||
public interface RolloutApprovalStrategy {
|
||||
|
||||
/**
|
||||
* This method handles whether a rollout needs approval. Various factors may be
|
||||
* important according to the implementation, e.g. user roles of the rollout
|
||||
* creator, state of the system, ....
|
||||
*
|
||||
* @param rollout
|
||||
* rollout to decide for whether approval is needed.
|
||||
* @return true if the rollout according to this strategy needs approval.
|
||||
*/
|
||||
boolean isApprovalNeeded(Rollout rollout);
|
||||
|
||||
/**
|
||||
* Depending on the implementation, creation of a approval task,
|
||||
* notification,... inside or outside of hawkbit may be necessary.
|
||||
* Implementations may also decide to provide an empty implementation for this
|
||||
* method.
|
||||
*
|
||||
* @param rollout
|
||||
* rollout to create approval task for.
|
||||
*/
|
||||
void onApprovalRequired(Rollout rollout);
|
||||
|
||||
/**
|
||||
* Returns the user that made a decision to approve or deny the given rollout.
|
||||
* Depending on the implementation this may be different to the current user eg.
|
||||
* when the decision is made in an external system.
|
||||
*
|
||||
* @param rollout
|
||||
* target rollout
|
||||
* @return identifier of the user that decided on approval
|
||||
*/
|
||||
String getApprovalUser(Rollout rollout);
|
||||
}
|
||||
@@ -71,4 +71,10 @@ hawkbit.server.tenant.configuration.anonymous-download-enabled.keyName=anonymous
|
||||
hawkbit.server.tenant.configuration.anonymous-download-enabled.defaultValue=${hawkbit.server.download.anonymous.enabled}
|
||||
hawkbit.server.tenant.configuration.anonymous-download-enabled.dataType=java.lang.Boolean
|
||||
hawkbit.server.tenant.configuration.anonymous-download-enabled.validator=org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator
|
||||
|
||||
hawkbit.server.tenant.configuration.rollout-approval-enabled.keyName=rollout.approval.enabled
|
||||
hawkbit.server.tenant.configuration.rollout-approval-enabled.defaultValue=false
|
||||
hawkbit.server.tenant.configuration.rollout-approval-enabled.dataType=java.lang.Boolean
|
||||
hawkbit.server.tenant.configuration.rollout-approval-enabled.validator=org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator
|
||||
|
||||
# Default tenant configuration - END
|
||||
|
||||
Reference in New Issue
Block a user