Skip to content
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

Merged
merged 7 commits into from Oct 19, 2023
Merged

Rollout retry #1454

merged 7 commits into from Oct 19, 2023

Conversation

strailov
Copy link
Contributor

No description provided.

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>
@hawkbit-bot
Copy link

Can one of the admins verify this patch?

@@ -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) {
Copy link
Contributor

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

Copy link
Contributor

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)

Copy link
Contributor Author

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 {
Copy link
Contributor

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"))
Copy link
Contributor

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));
Copy link
Contributor

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");
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

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));
Copy link
Contributor

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()));
Copy link
Contributor

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())
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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>
@avgustinmm
Copy link
Contributor

lgtm

@strailov strailov merged commit 44e7a72 into eclipse:master Oct 19, 2023
2 checks passed
@strailov strailov deleted the feature/retry_rollout branch October 19, 2023 06:58
@avgustinmm avgustinmm added this to the 0.3.0 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants