Initial Contribution of the rollout-management feature

- Repository functionality for rollout, rolloutgroup entities
- Rollout scheduler to watch and handle running rollouts and start next
group of rollout
- Vaadin view to administrate rollouts and reflect the current rollout
status
- REST resources to cover rollout creation, updating, starting, pausing
and resuming

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-02-04 15:10:44 +01:00
parent 5331a9c06e
commit f18825ce34
145 changed files with 13995 additions and 353 deletions

View File

@@ -154,6 +154,16 @@ public final class RestConstants {
*/
public static final String DISTRIBUTIONSET_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/distributionsets";
/**
* The rollout URL mapping rest resource.
*/
public static final String ROLLOUT_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/rollouts";
/**
* Request parameter for async
*/
public static final String REQUEST_PARAMETER_ASYNC = "async";
/**
* The target URL mapping, href link for artifact download.
*/

View File

@@ -14,7 +14,7 @@ import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list rest model for {@link Action} to RESTful API representation.
* Paged list rest model for {@link ErrorAction} to RESTful API representation.
*
*/
public class ActionPagedList extends PagedList<ActionRest> {

View File

@@ -0,0 +1,69 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rollout;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RolloutCondition {
private Condition condition = Condition.THRESHOLD;
private String expression = "100";
/**
*
*/
public RolloutCondition() {
}
public RolloutCondition(final Condition condition, final String expression) {
this.condition = condition;
this.expression = expression;
}
/**
* @return the condition
*/
public Condition getCondition() {
return condition;
}
/**
* @param condition
* the condition to set
*/
public void setCondition(final Condition condition) {
this.condition = condition;
}
/**
* @return the expession
*/
public String getExpression() {
return expression;
}
/**
* @param expession
* the expession to set
*/
public void setExpression(final String expession) {
this.expression = expession;
}
public enum Condition {
THRESHOLD;
}
}

View File

@@ -0,0 +1,58 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rollout;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RolloutErrorAction {
private ErrorAction action = ErrorAction.PAUSE;
private String expression = null;
/**
* @return the action
*/
public ErrorAction getAction() {
return action;
}
/**
* @param action
* the action to set
*/
public void setAction(final ErrorAction action) {
this.action = action;
}
/**
* @return the expression
*/
public String getExpression() {
return expression;
}
/**
* @param expression
* the expression to set
*/
public void setExpression(final String expression) {
this.expression = expression;
}
public enum ErrorAction {
PAUSE;
}
}

View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rollout;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for Rollout.
*
*
*/
public class RolloutPagedList extends PagedList<RolloutResponseBody> {
private final List<RolloutResponseBody> content;
public RolloutPagedList(final List<RolloutResponseBody> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<RolloutResponseBody> getContent() {
return content;
}
}

View File

@@ -0,0 +1,124 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rollout;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.hawkbit.rest.resource.model.NamedEntityRest;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RolloutResponseBody extends NamedEntityRest {
private String targetFilterQuery;
private Long distributionSetId;
@JsonProperty(value = "id", required = true)
private Long rolloutId;
@JsonProperty(required = true)
private String status;
@JsonProperty(required = true)
private Long totalTargets;
@JsonProperty(required = true)
private final Map<String, Long> totalTargetsPerStatus = new HashMap<>();
/**
* @return the status
*/
public String getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(final String status) {
this.status = status;
}
/**
* @return the rolloutId
*/
public Long getRolloutId() {
return rolloutId;
}
/**
* @param rolloutId
* the rolloutId to set
*/
public void setRolloutId(final Long rolloutId) {
this.rolloutId = rolloutId;
}
/**
* @return the targetFilterQuery
*/
public String getTargetFilterQuery() {
return targetFilterQuery;
}
/**
* @param targetFilterQuery
* the targetFilterQuery to set
*/
public void setTargetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
}
/**
* @return the distributionSetId
*/
public Long getDistributionSetId() {
return distributionSetId;
}
/**
* @param distributionSetId
* the distributionSetId to set
*/
public void setDistributionSetId(final Long distributionSetId) {
this.distributionSetId = distributionSetId;
}
/**
* @param totalTargets
* the totalTargets to set
*/
public void setTotalTargets(final Long totalTargets) {
this.totalTargets = totalTargets;
}
/**
* @return the totalTargets
*/
public Long getTotalTargets() {
return totalTargets;
}
/**
* @return the totalTargetsPerStatus
*/
public Map<String, Long> getTotalTargetsPerStatus() {
return totalTargetsPerStatus;
}
}

View File

@@ -0,0 +1,175 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rollout;
import org.eclipse.hawkbit.rest.resource.model.NamedEntityRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.ActionTypeRest;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
* Model for request containing a rollout body e.g. in a POST request of
* creating a rollout via REST API.
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RolloutRestRequestBody extends NamedEntityRest {
private String targetFilterQuery;
private long distributionSetId;
private int amountGroups = 1;
private RolloutCondition successCondition = new RolloutCondition();
private RolloutSuccessAction successAction = new RolloutSuccessAction();
private RolloutCondition errorCondition = null;
private RolloutErrorAction errorAction = null;
private Long forcetime;
private ActionTypeRest type;
/**
* @return the finishCondition
*/
public RolloutCondition getSuccessCondition() {
return successCondition;
}
/**
* @param successCondition
* the finishCondition to set
*/
public void setSuccessCondition(final RolloutCondition successCondition) {
this.successCondition = successCondition;
}
/**
* @return the successAction
*/
public RolloutSuccessAction getSuccessAction() {
return successAction;
}
/**
* @param successAction
* the successAction to set
*/
public void setSuccessAction(final RolloutSuccessAction successAction) {
this.successAction = successAction;
}
/**
* @return the errorCondition
*/
public RolloutCondition getErrorCondition() {
return errorCondition;
}
/**
* @param errorCondition
* the errorCondition to set
*/
public void setErrorCondition(final RolloutCondition errorCondition) {
this.errorCondition = errorCondition;
}
/**
* @return the targetFilterQuery
*/
public String getTargetFilterQuery() {
return targetFilterQuery;
}
/**
* @param targetFilterQuery
* the targetFilterQuery to set
*/
public void setTargetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
}
/**
* @return the distributionSetId
*/
public long getDistributionSetId() {
return distributionSetId;
}
/**
* @param distributionSetId
* the distributionSetId to set
*/
public void setDistributionSetId(final long distributionSetId) {
this.distributionSetId = distributionSetId;
}
/**
* @return the groupSize
*/
public int getAmountGroups() {
return amountGroups;
}
/**
* @param groupSize
* the groupSize to set
*/
public void setAmountGroups(final int groupSize) {
this.amountGroups = groupSize;
}
/**
* @return the forcetime
*/
public Long getForcetime() {
return forcetime;
}
/**
* @param forcetime
* the forcetime to set
*/
public void setForcetime(final Long forcetime) {
this.forcetime = forcetime;
}
/**
* @return the type
*/
public ActionTypeRest getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(final ActionTypeRest type) {
this.type = type;
}
/**
* @return the errorAction
*/
public RolloutErrorAction getErrorAction() {
return errorAction;
}
/**
* @param errorAction
* the errorAction to set
*/
public void setErrorAction(final RolloutErrorAction errorAction) {
this.errorAction = errorAction;
}
}

View File

@@ -0,0 +1,69 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rollout;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RolloutSuccessAction {
private SuccessAction action = SuccessAction.NEXTGROUP;
private String expression = null;
/**
*
*/
public RolloutSuccessAction() {
}
public RolloutSuccessAction(final SuccessAction action, final String expression) {
this.action = action;
this.expression = expression;
}
/**
* @return the action
*/
public SuccessAction getAction() {
return action;
}
/**
* @param action
* the action to set
*/
public void setAction(final SuccessAction action) {
this.action = action;
}
/**
* @return the expession
*/
public String getExpression() {
return expression;
}
/**
* @param expession
* the expession to set
*/
public void setExpression(final String expession) {
this.expression = expession;
}
public enum SuccessAction {
NEXTGROUP;
}
}

View File

@@ -0,0 +1,35 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rolloutgroup;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for Rollout.
*
*/
public class RolloutGroupPagedList extends PagedList<RolloutGroupResponseBody> {
private final List<RolloutGroupResponseBody> content;
public RolloutGroupPagedList(final List<RolloutGroupResponseBody> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<RolloutGroupResponseBody> getContent() {
return content;
}
}

View File

@@ -0,0 +1,61 @@
/**
* Copyright (c) 2015 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.rest.resource.model.rolloutgroup;
import org.eclipse.hawkbit.rest.resource.model.NamedEntityRest;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model for the rollout group annotated with json-annotations for easier
* serialization and de-serialization.
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RolloutGroupResponseBody extends NamedEntityRest {
@JsonProperty(value = "id", required = true)
private Long rolloutGroupId;
@JsonProperty(required = true)
private String status;
/**
* @return the rolloutGroupId
*/
public Long getRolloutGroupId() {
return rolloutGroupId;
}
/**
* @param rolloutGroupId
* the rolloutGroupId to set
*/
public void setRolloutGroupId(final Long rolloutGroupId) {
this.rolloutGroupId = rolloutGroupId;
}
/**
* @return the status
*/
public String getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(final String status) {
this.status = status;
}
}