Trigger next rollout group - backend and management API implementatio… (#1294)

* Trigger next rollout group - backend and management API implementations. Backend and management API tests.
* Trigger next rollout group - Fixed resource documentation test.
* Trigger next rollout group - Fixed resource documentation test.
* add rest docs
* Trigger next rollout group - UI changes. New button for trigger next rollout group in rollout view.
* add error test for rest api
* Trigger next rollout group - Added test for triggering next group for all rollout states.
* add confirm
* fix test
* replace DB calls
* fix translation
* fix error message

Signed-off-by: Dimitar Shterev <dimitar.shterev@bosch.io>
Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>
Co-authored-by: Stefan Klotz <stefan.klotz@bosch.io>
This commit is contained in:
Dimitar Shterev
2023-01-12 14:22:09 +02:00
committed by GitHub
parent ed1e7d8da2
commit 2db45a4cc5
15 changed files with 370 additions and 5 deletions

View File

@@ -356,6 +356,39 @@ include::../errors/406.adoc[]
include::../errors/429.adoc[]
|===
== POST /rest/v1/rollouts/{rolloutId}/triggerNextGroup
=== Implementation Notes
Handles the POST request of triggering the next group of a rollout within Hawkbit. Required Permission: UPDATE_ROLLOUT
=== Trigger next group
==== CURL
include::{snippets}/rollouts/trigger-next-group/curl-request.adoc[]
==== Request URL
include::{snippets}/rollouts/trigger-next-group/http-request.adoc[]
==== Response example
include::{snippets}/rollouts/trigger-next-group/http-response.adoc[]
=== Error responses
|===
| HTTP Status Code | Reason | Response Model
include::../errors/400.adoc[]
include::../errors/401.adoc[]
include::../errors/403.adoc[]
include::../errors/405.adoc[]
include::../errors/406.adoc[]
include::../errors/429.adoc[]
|===
== DELETE /rest/v1/rollouts/{rolloutId}
=== Implementation Notes

View File

@@ -118,6 +118,7 @@ public final class MgmtApiModelProperties {
public static final String ROLLOUT_LINKS_START_SYNC = "Link to start the rollout in sync mode";
public static final String ROLLOUT_LINKS_START_ASYNC = "Link to start the rollout in async mode";
public static final String ROLLOUT_LINKS_PAUSE = "Link to pause a running rollout";
public static final String ROLLOUT_LINKS_TRIGGER_NEXT_GROUP = "Link for triggering next rollout group on a running rollout";
public static final String ROLLOUT_LINKS_RESUME = "Link to resume a paused rollout";
public static final String ROLLOUT_LINKS_APPROVE = "Link to approve a rollout";
public static final String ROLLOUT_LINKS_DENY = "Link to deny a rollout";

View File

@@ -147,6 +147,8 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
.description(MgmtApiModelProperties.ROLLOUT_LINKS_START_SYNC));
allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.pause")
.description(MgmtApiModelProperties.ROLLOUT_LINKS_PAUSE));
allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.triggerNextGroup")
.description(MgmtApiModelProperties.ROLLOUT_LINKS_TRIGGER_NEXT_GROUP));
allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.resume")
.description(MgmtApiModelProperties.ROLLOUT_LINKS_RESUME));
allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.groups")
@@ -444,6 +446,23 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID))));
}
@Test
@Description("Handles the POST request of triggering the next group of a rollout. Required Permission: "
+ SpPermission.UPDATE_ROLLOUT)
public void triggerNextGroup() throws Exception {
final Rollout rollout = createRolloutEntity();
rolloutManagement.start(rollout.getId());
// Run here, because scheduler is disabled during tests
rolloutManagement.handleRollouts();
mockMvc.perform(
post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/triggerNextGroup", rollout.getId())
.accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()).andDo(this.document.document(
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID))));
}
@Test
@Description("Handles the GET request of retrieving the deploy groups of a rollout. Required Permission: "
+ SpPermission.READ_ROLLOUT)