New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollout retry #1454
Rollout retry #1454
Conversation
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
Can one of the admins verify this patch? |
...tory/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutHelper.java
Show resolved
Hide resolved
@@ -730,4 +752,38 @@ public void triggerNextGroup(final long rolloutId) { | |||
startNextRolloutGroupAction.exec(rollout, latestRunning); | |||
} | |||
|
|||
private TargetCount calculateTargetsAndFilterBasedOnRetriedRollout(final String targetFilter, final Long createdAt, final Long dsTypeId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improper name = could be not based on retried
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see need to have different method if it adds new type TargetCount (again not correctly reflects the class content)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different method was needed in order to escape duplication ...
return new TargetCount(totalTargets, baseFilter); | ||
} | ||
|
||
private static class TargetCount { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be record
@@ -132,6 +132,18 @@ static RolloutCreate fromRequest(final EntityFactory entityFactory, final MgmtRo | |||
.weight(restRequest.getWeight()); | |||
} | |||
|
|||
static RolloutCreate fromRetriedRollout(final EntityFactory entityFactory, final Rollout rollout) { | |||
return entityFactory.rollout().create() | |||
.name(rollout.getName().concat("_retried")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better "_retry"
TargetSpecifications.isCompatibleWithDistributionSetType(dsTypeId)); | ||
|
||
if (createdAt != null) { | ||
specList.add(TargetSpecifications.createdBefore(createdAt)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why createdBefore is used - rollout fail filter would not contain devices created after anyway
@@ -253,4 +256,12 @@ public static void checkIfRolloutCanStarted(final Rollout rollout, final Rollout | |||
+ rollout.getStatus().name().toLowerCase()); | |||
} | |||
} | |||
|
|||
public static boolean isRolloutRetried(final String targetFilter) { | |||
return targetFilter.contains("failedRollout"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this case sensitive?
aren't lower cased attributes are supported at the moment? e.g. "createdat"
if search attributes are case insensitive this check shall be also such.
If not - better use lowercase as in other cases
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
@@ -616,12 +626,21 @@ public void cancelRolloutsForDistributionSet(final DistributionSet set) { | |||
} | |||
|
|||
private RolloutGroupsValidation validateTargetsInGroups(final List<RolloutGroup> groups, final String baseFilter, | |||
final long totalTargets, final Long dsTypeId) { | |||
final long totalTargets, final Long dsTypeId, final Long createdAt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createdAt is not really used anymore
}; | ||
} | ||
|
||
public static Specification<JpaTarget> createdBefore(final Long time) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this specification used?
* @param dsTypeId | ||
* ID of the {@link DistributionSetType} the targets need to be | ||
* compatible with | ||
* @param createdAt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a parameter anymore
public long countByFailedInRolloutAndCompatible(final String rolloutId, final Long dsTypeId) { | ||
final List<Specification<JpaTarget>> specList = Arrays.asList( | ||
TargetSpecifications.failedActionsForRollout(rolloutId), | ||
TargetSpecifications.isCompatibleWithDistributionSetType(dsTypeId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't the failed targets already checked for compatibility?
final List<Specification<JpaTarget>> specList = Arrays.asList( | ||
TargetSpecifications.failedActionsForRollout(rolloutId), | ||
TargetSpecifications.isNotInRolloutGroups(groups), | ||
TargetSpecifications.isCompatibleWithDistributionSetType(distributionSetType.getId())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't the failed targets already checked for compatibility?
final List<Specification<JpaTarget>> specList = Arrays.asList( | ||
TargetSpecifications.failedActionsForRollout(rolloutId), | ||
TargetSpecifications.isNotInRolloutGroups(groups), | ||
TargetSpecifications.isCompatibleWithDistributionSetType(distributionSetType.getId()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't the failed targets already checked for compatibility?
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
* the list of {@link RolloutGroup}s | ||
* @param rolloutId | ||
* rolloutId of the rollout to be retried. | ||
* @param distributionSetType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a parameter anymore
* the list of {@link RolloutGroup}s | ||
* @param rolloutId | ||
* rolloutId of the rollout to be retried. | ||
* @param distributionSetType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not parameter anymore
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
lgtm |
No description provided.