Skip to content

Commit

Permalink
Fixes #31 Add "approvals_syncing" to list of mr status that we want t…
Browse files Browse the repository at this point in the history
…o wait on (#32)

Co-authored-by: Fábio Pereira <[email protected]>
  • Loading branch information
fbpe and fbpe authored Sep 24, 2024
1 parent d673fc5 commit 129adbe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _documentation/src/docs/diagrams/technical-workflow.puml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (incoming request?) then (yes)
Timeout to avoid the possibility
of getting stuck in the loop forever
end note
while(MRStatus == unchecked|checking and countdown > 0?) is (yes)
while(MRStatus == unchecked|checking|preparing|approvals_syncing and countdown > 0?) is (yes)
#SkyBlue:decrement countDown by 1;
:sleep 1s;
note right: Wait for Gitlab to prepare MR
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/service/GitLabService.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ private MergeRequest getExistingMr(String gitlabEventUUID, MergeRequest mr) {
}

public static boolean isMrReady(String mrStatus, boolean approverExists, Boolean hasConflicts) {
return !(mrStatus.matches("unchecked|checking|preparing") ||
return !(mrStatus.matches("unchecked|checking|preparing|approvals_syncing") ||
(approverExists && mrStatus.matches("not_approved")) ||
!(hasConflicts != null && hasConflicts) && mrStatus.matches("broken_status"));
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/unblu/ucascade/UcascadeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ void testMrReady() {
Assertions.assertFalse(GitLabService.isMrReady("checking", true, false));
Assertions.assertFalse(GitLabService.isMrReady("preparing", false, false));
Assertions.assertFalse(GitLabService.isMrReady("preparing", true, false));
Assertions.assertFalse(GitLabService.isMrReady("approvals_syncing", false, false));
Assertions.assertFalse(GitLabService.isMrReady("approvals_syncing", true, false));
Assertions.assertFalse(GitLabService.isMrReady("broken_status", true, false));
Assertions.assertFalse(GitLabService.isMrReady("broken_status", false, false));
Assertions.assertFalse(GitLabService.isMrReady("broken_status", false, null));
Expand Down

0 comments on commit 129adbe

Please sign in to comment.