feat(proto): add MarkReady, mr:force-merge and ignore_checks, drop failing_checks_block
9 files · +339 -144
M docs/services.md +1 -1
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | | `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask, merge settings), `DeleteRepo` | | |
| 6 | 6 | | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` | | |
| 7 | 7 | | `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` | | |
| 8 | - | | `MergeRequestService` | `CreateMergeRequest`, `ListMergeRequests`, `GetMergeRequest` (commits, diff, comments), `AddComment`, `EditComment`, `DeleteComment`, `ResolveComment`, `CloseMergeRequest`, `MergeMergeRequest` (modes fast-forward, squash, merge commit), `MarkRead`, `EnableAutoMerge`, `CancelAutoMerge` (merge by itself once a check passed on the head and all its runs are complete; setting `allow_auto_merge`, `MergeRequest.auto_merge`, events `MergeRequestAutoMergeEnabled` and `MergeRequestAutoMergeCancelled`, `MergeRequestMerged.auto`; feature `merge_requests.auto_merge`). Open merge requests carry `mergeability` (up to date, behind, conflict, or checking) and `Watch` publishes `MergeRequestMergeability` each time a result is settled for new branch tips (feature `merge_requests.mergeability`) | | |
| 8 | + | | `MergeRequestService` | `CreateMergeRequest`, `ListMergeRequests`, `GetMergeRequest` (commits, diff, comments), `AddComment`, `EditComment`, `DeleteComment`, `ResolveComment`, `CloseMergeRequest`, `MarkReady`, `MergeMergeRequest` (modes fast-forward, squash, merge commit), `MarkRead`, `EnableAutoMerge`, `CancelAutoMerge` (merge by itself once a check passed on the head and all its runs are complete; setting `allow_auto_merge`, `MergeRequest.auto_merge`, events `MergeRequestAutoMergeEnabled` and `MergeRequestAutoMergeCancelled`, `MergeRequestMerged.auto`; feature `merge_requests.auto_merge`). Open merge requests carry `mergeability` (up to date, behind, conflict, or checking) and `Watch` publishes `MergeRequestMergeability` each time a result is settled for new branch tips (feature `merge_requests.mergeability`) | | |
| 9 | 9 | | `IssueService` | `CreateIssue`, `ListIssues`, `GetIssue` (comments, merge requests naming the issue, `closed_by_merge_request`), `AddIssueComment`, `CloseIssue`, `ReopenIssue`; owner only: `ListPendingIssues`, `ApproveIssue`, `RejectIssue`. Features `issues`, `issues.links`. Issues share numbers with merge requests | | |
| 10 | 10 | | `SessionService` | `CreateLoginLink`, `SignOutEverywhere` (owner only) | | |
| 11 | 11 | | `EventService` | `Watch` (streamed, resumable). Topics `home`, `repo:<name>` and `owner` (owner rights only). Events 17–21: `issue_opened`, `issue_closed`, `issue_reopened`, `issue_commented`, and `issue_submitted` (only on `owner`, no content). Event 22: `merge_request_mergeability` | | |
| @@ -5,7 +5,7 @@ | |||||
| 5 | | `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask, merge settings), `DeleteRepo` | | 5 | | `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask, merge settings), `DeleteRepo` | | ||
| 6 | | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` | | 6 | | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` | | ||
| 7 | | `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` | | 7 | | `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` | | ||
| 8 | - | | `MergeRequestService` | `CreateMergeRequest`, `ListMergeRequests`, `GetMergeRequest` (commits, diff, comments), `AddComment`, `EditComment`, `DeleteComment`, `ResolveComment`, `CloseMergeRequest`, `MergeMergeRequest` (modes fast-forward, squash, merge commit), `MarkRead`, `EnableAutoMerge`, `CancelAutoMerge` (merge by itself once a check passed on the head and all its runs are complete; setting `allow_auto_merge`, `MergeRequest.auto_merge`, events `MergeRequestAutoMergeEnabled` and `MergeRequestAutoMergeCancelled`, `MergeRequestMerged.auto`; feature `merge_requests.auto_merge`). Open merge requests carry `mergeability` (up to date, behind, conflict, or checking) and `Watch` publishes `MergeRequestMergeability` each time a result is settled for new branch tips (feature `merge_requests.mergeability`) | | 8 | + | | `MergeRequestService` | `CreateMergeRequest`, `ListMergeRequests`, `GetMergeRequest` (commits, diff, comments), `AddComment`, `EditComment`, `DeleteComment`, `ResolveComment`, `CloseMergeRequest`, `MarkReady`, `MergeMergeRequest` (modes fast-forward, squash, merge commit), `MarkRead`, `EnableAutoMerge`, `CancelAutoMerge` (merge by itself once a check passed on the head and all its runs are complete; setting `allow_auto_merge`, `MergeRequest.auto_merge`, events `MergeRequestAutoMergeEnabled` and `MergeRequestAutoMergeCancelled`, `MergeRequestMerged.auto`; feature `merge_requests.auto_merge`). Open merge requests carry `mergeability` (up to date, behind, conflict, or checking) and `Watch` publishes `MergeRequestMergeability` each time a result is settled for new branch tips (feature `merge_requests.mergeability`) | |
| 9 | | `IssueService` | `CreateIssue`, `ListIssues`, `GetIssue` (comments, merge requests naming the issue, `closed_by_merge_request`), `AddIssueComment`, `CloseIssue`, `ReopenIssue`; owner only: `ListPendingIssues`, `ApproveIssue`, `RejectIssue`. Features `issues`, `issues.links`. Issues share numbers with merge requests | | 9 | | `IssueService` | `CreateIssue`, `ListIssues`, `GetIssue` (comments, merge requests naming the issue, `closed_by_merge_request`), `AddIssueComment`, `CloseIssue`, `ReopenIssue`; owner only: `ListPendingIssues`, `ApproveIssue`, `RejectIssue`. Features `issues`, `issues.links`. Issues share numbers with merge requests | | ||
| 10 | | `SessionService` | `CreateLoginLink`, `SignOutEverywhere` (owner only) | | 10 | | `SessionService` | `CreateLoginLink`, `SignOutEverywhere` (owner only) | | ||
| 11 | | `EventService` | `Watch` (streamed, resumable). Topics `home`, `repo:<name>` and `owner` (owner rights only). Events 17–21: `issue_opened`, `issue_closed`, `issue_reopened`, `issue_commented`, and `issue_submitted` (only on `owner`, no content). Event 22: `merge_request_mergeability` | | 11 | | `EventService` | `Watch` (streamed, resumable). Topics `home`, `repo:<name>` and `owner` (owner rights only). Events 17–21: `issue_opened`, `issue_closed`, `issue_reopened`, `issue_commented`, and `issue_submitted` (only on `owner`, no content). Event 22: `merge_request_mergeability` | | ||
M gen/ermite/ermiteconnect/merge_request.connect.go +57 -12
| @@ -59,6 +59,9 @@ const ( | |||
| 59 | 59 | // MergeRequestServiceCloseMergeRequestProcedure is the fully-qualified name of the | |
| 60 | 60 | // MergeRequestService's CloseMergeRequest RPC. | |
| 61 | 61 | MergeRequestServiceCloseMergeRequestProcedure = "/ermite.MergeRequestService/CloseMergeRequest" | |
| 62 | + | // MergeRequestServiceMarkReadyProcedure is the fully-qualified name of the MergeRequestService's | |
| 63 | + | // MarkReady RPC. | |
| 64 | + | MergeRequestServiceMarkReadyProcedure = "/ermite.MergeRequestService/MarkReady" | |
| 62 | 65 | // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the | |
| 63 | 66 | // MergeRequestService's MergeMergeRequest RPC. | |
| 64 | 67 | MergeRequestServiceMergeMergeRequestProcedure = "/ermite.MergeRequestService/MergeMergeRequest" | |
| @@ -127,7 +130,16 @@ type MergeRequestServiceClient interface { | |||
| 127 | 130 | // the mr:write scope. Fails with failed_precondition if the merge request | |
| 128 | 131 | // is not open. A closed merge request cannot be reopened: open a new one. | |
| 129 | 132 | CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) | |
| 130 | - | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. | |
| 133 | + | // MarkReady removes the draft prefix ("WIP:" or "[WIP]") from the title so | |
| 134 | + | // the merge request can be merged. Needs the mr:write scope. Fails with | |
| 135 | + | // failed_precondition if the merge request is not open or is not a draft. | |
| 136 | + | // Publishes no event: there is none for a change of title. Needs the | |
| 137 | + | // "merge_requests.ready" feature. | |
| 138 | + | MarkReady(context.Context, *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) | |
| 139 | + | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope, | |
| 140 | + | // which merges only when the checks on the head allow it: none failed and | |
| 141 | + | // none queued or running (a head with no checks may be merged; success, | |
| 142 | + | // skipped and neutral pass). The mr:force-merge scope allows ignore_checks. | |
| 131 | 143 | // The caller passes the head it reviewed: the server merges only if the | |
| 132 | 144 | // source branch still points to it, so a push between review and merge is | |
| 133 | 145 | // never merged unseen. Fails with invalid_argument if head_id is empty or | |
| @@ -137,17 +149,17 @@ type MergeRequestServiceClient interface { | |||
| 137 | 149 | // ancestor of the head (rebase and push again, or merge with squash or | |
| 138 | 150 | // merge commit), if the mode is squash or merge commit and the head | |
| 139 | 151 | // conflicts with the target or shares no history with it (rebase and push | |
| 140 | - | // again), if the mode is not allowed by RepoSettings, or if a check fails | |
| 141 | - | // and RepoSettings.failing_checks_block is set. Merges of one | |
| 152 | + | // again), if the mode is not allowed by RepoSettings, or if a check failed or | |
| 153 | + | // has not finished, unless ignore_checks is set. Merges of one | |
| 142 | 154 | // repository run one at a time. Repeating a call that succeeded fails with | |
| 143 | 155 | // failed_precondition (not open). On success the server publishes | |
| 144 | 156 | // MergeRequestMerged then Pushed for the target branch. | |
| 145 | 157 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | |
| 146 | 158 | // EnableAutoMerge asks the server to merge an open merge request by itself | |
| 147 | 159 | // once at least one check passed on its head, every run created on that head | |
| 148 | - | // is complete, and the merge would be accepted whatever | |
| 149 | - | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 150 | - | // token limited to branches, write access to the target branch | |
| 160 | + | // is complete, and no check failed. It does not take ignore_checks. Needs | |
| 161 | + | // the mr:merge scope and, for a token limited to branches, write access to | |
| 162 | + | // the target branch | |
| 151 | 163 | // (permission_denied otherwise). The server records the caller, the mode and | |
| 152 | 164 | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 153 | 165 | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| @@ -232,6 +244,12 @@ func NewMergeRequestServiceClient(httpClient connect.HTTPClient, baseURL string, | |||
| 232 | 244 | connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), | |
| 233 | 245 | connect.WithClientOptions(opts...), | |
| 234 | 246 | ), | |
| 247 | + | markReady: connect.NewClient[ermite.MarkReadyRequest, ermite.MarkReadyResponse]( | |
| 248 | + | httpClient, | |
| 249 | + | baseURL+MergeRequestServiceMarkReadyProcedure, | |
| 250 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("MarkReady")), | |
| 251 | + | connect.WithClientOptions(opts...), | |
| 252 | + | ), | |
| 235 | 253 | mergeMergeRequest: connect.NewClient[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse]( | |
| 236 | 254 | httpClient, | |
| 237 | 255 | baseURL+MergeRequestServiceMergeMergeRequestProcedure, | |
| @@ -269,6 +287,7 @@ type mergeRequestServiceClient struct { | |||
| 269 | 287 | deleteComment *connect.Client[ermite.DeleteCommentRequest, ermite.DeleteCommentResponse] | |
| 270 | 288 | resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse] | |
| 271 | 289 | closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse] | |
| 290 | + | markReady *connect.Client[ermite.MarkReadyRequest, ermite.MarkReadyResponse] | |
| 272 | 291 | mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse] | |
| 273 | 292 | enableAutoMerge *connect.Client[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse] | |
| 274 | 293 | cancelAutoMerge *connect.Client[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse] | |
| @@ -315,6 +334,11 @@ func (c *mergeRequestServiceClient) CloseMergeRequest(ctx context.Context, req * | |||
| 315 | 334 | return c.closeMergeRequest.CallUnary(ctx, req) | |
| 316 | 335 | } | |
| 317 | 336 | ||
| 337 | + | // MarkReady calls ermite.MergeRequestService.MarkReady. | |
| 338 | + | func (c *mergeRequestServiceClient) MarkReady(ctx context.Context, req *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) { | |
| 339 | + | return c.markReady.CallUnary(ctx, req) | |
| 340 | + | } | |
| 341 | + | ||
| 318 | 342 | // MergeMergeRequest calls ermite.MergeRequestService.MergeMergeRequest. | |
| 319 | 343 | func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { | |
| 320 | 344 | return c.mergeMergeRequest.CallUnary(ctx, req) | |
| @@ -389,7 +413,16 @@ type MergeRequestServiceHandler interface { | |||
| 389 | 413 | // the mr:write scope. Fails with failed_precondition if the merge request | |
| 390 | 414 | // is not open. A closed merge request cannot be reopened: open a new one. | |
| 391 | 415 | CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) | |
| 392 | - | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. | |
| 416 | + | // MarkReady removes the draft prefix ("WIP:" or "[WIP]") from the title so | |
| 417 | + | // the merge request can be merged. Needs the mr:write scope. Fails with | |
| 418 | + | // failed_precondition if the merge request is not open or is not a draft. | |
| 419 | + | // Publishes no event: there is none for a change of title. Needs the | |
| 420 | + | // "merge_requests.ready" feature. | |
| 421 | + | MarkReady(context.Context, *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) | |
| 422 | + | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope, | |
| 423 | + | // which merges only when the checks on the head allow it: none failed and | |
| 424 | + | // none queued or running (a head with no checks may be merged; success, | |
| 425 | + | // skipped and neutral pass). The mr:force-merge scope allows ignore_checks. | |
| 393 | 426 | // The caller passes the head it reviewed: the server merges only if the | |
| 394 | 427 | // source branch still points to it, so a push between review and merge is | |
| 395 | 428 | // never merged unseen. Fails with invalid_argument if head_id is empty or | |
| @@ -399,17 +432,17 @@ type MergeRequestServiceHandler interface { | |||
| 399 | 432 | // ancestor of the head (rebase and push again, or merge with squash or | |
| 400 | 433 | // merge commit), if the mode is squash or merge commit and the head | |
| 401 | 434 | // conflicts with the target or shares no history with it (rebase and push | |
| 402 | - | // again), if the mode is not allowed by RepoSettings, or if a check fails | |
| 403 | - | // and RepoSettings.failing_checks_block is set. Merges of one | |
| 435 | + | // again), if the mode is not allowed by RepoSettings, or if a check failed or | |
| 436 | + | // has not finished, unless ignore_checks is set. Merges of one | |
| 404 | 437 | // repository run one at a time. Repeating a call that succeeded fails with | |
| 405 | 438 | // failed_precondition (not open). On success the server publishes | |
| 406 | 439 | // MergeRequestMerged then Pushed for the target branch. | |
| 407 | 440 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | |
| 408 | 441 | // EnableAutoMerge asks the server to merge an open merge request by itself | |
| 409 | 442 | // once at least one check passed on its head, every run created on that head | |
| 410 | - | // is complete, and the merge would be accepted whatever | |
| 411 | - | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 412 | - | // token limited to branches, write access to the target branch | |
| 443 | + | // is complete, and no check failed. It does not take ignore_checks. Needs | |
| 444 | + | // the mr:merge scope and, for a token limited to branches, write access to | |
| 445 | + | // the target branch | |
| 413 | 446 | // (permission_denied otherwise). The server records the caller, the mode and | |
| 414 | 447 | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 415 | 448 | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| @@ -490,6 +523,12 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||
| 490 | 523 | connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), | |
| 491 | 524 | connect.WithHandlerOptions(opts...), | |
| 492 | 525 | ) | |
| 526 | + | mergeRequestServiceMarkReadyHandler := connect.NewUnaryHandler( | |
| 527 | + | MergeRequestServiceMarkReadyProcedure, | |
| 528 | + | svc.MarkReady, | |
| 529 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("MarkReady")), | |
| 530 | + | connect.WithHandlerOptions(opts...), | |
| 531 | + | ) | |
| 493 | 532 | mergeRequestServiceMergeMergeRequestHandler := connect.NewUnaryHandler( | |
| 494 | 533 | MergeRequestServiceMergeMergeRequestProcedure, | |
| 495 | 534 | svc.MergeMergeRequest, | |
| @@ -532,6 +571,8 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||
| 532 | 571 | mergeRequestServiceResolveCommentHandler.ServeHTTP(w, r) | |
| 533 | 572 | case MergeRequestServiceCloseMergeRequestProcedure: | |
| 534 | 573 | mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r) | |
| 574 | + | case MergeRequestServiceMarkReadyProcedure: | |
| 575 | + | mergeRequestServiceMarkReadyHandler.ServeHTTP(w, r) | |
| 535 | 576 | case MergeRequestServiceMergeMergeRequestProcedure: | |
| 536 | 577 | mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r) | |
| 537 | 578 | case MergeRequestServiceEnableAutoMergeProcedure: | |
| @@ -581,6 +622,10 @@ func (UnimplementedMergeRequestServiceHandler) CloseMergeRequest(context.Context | |||
| 581 | 622 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CloseMergeRequest is not implemented")) | |
| 582 | 623 | } | |
| 583 | 624 | ||
| 625 | + | func (UnimplementedMergeRequestServiceHandler) MarkReady(context.Context, *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) { | |
| 626 | + | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkReady is not implemented")) | |
| 627 | + | } | |
| 628 | + | ||
| 584 | 629 | func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { | |
| 585 | 630 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented")) | |
| 586 | 631 | } | |
| @@ -59,6 +59,9 @@ const ( | |||||
| 59 | // MergeRequestServiceCloseMergeRequestProcedure is the fully-qualified name of the | 59 | // MergeRequestServiceCloseMergeRequestProcedure is the fully-qualified name of the | ||
| 60 | // MergeRequestService's CloseMergeRequest RPC. | 60 | // MergeRequestService's CloseMergeRequest RPC. | ||
| 61 | MergeRequestServiceCloseMergeRequestProcedure = "/ermite.MergeRequestService/CloseMergeRequest" | 61 | MergeRequestServiceCloseMergeRequestProcedure = "/ermite.MergeRequestService/CloseMergeRequest" | ||
| 62 | + | // MergeRequestServiceMarkReadyProcedure is the fully-qualified name of the MergeRequestService's | |||
| 63 | + | // MarkReady RPC. | |||
| 64 | + | MergeRequestServiceMarkReadyProcedure = "/ermite.MergeRequestService/MarkReady" | |||
| 62 | // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the | 65 | // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the | ||
| 63 | // MergeRequestService's MergeMergeRequest RPC. | 66 | // MergeRequestService's MergeMergeRequest RPC. | ||
| 64 | MergeRequestServiceMergeMergeRequestProcedure = "/ermite.MergeRequestService/MergeMergeRequest" | 67 | MergeRequestServiceMergeMergeRequestProcedure = "/ermite.MergeRequestService/MergeMergeRequest" | ||
| @@ -127,7 +130,16 @@ type MergeRequestServiceClient interface { | |||||
| 127 | // the mr:write scope. Fails with failed_precondition if the merge request | 130 | // the mr:write scope. Fails with failed_precondition if the merge request | ||
| 128 | // is not open. A closed merge request cannot be reopened: open a new one. | 131 | // is not open. A closed merge request cannot be reopened: open a new one. | ||
| 129 | CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) | 132 | CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) | ||
| 130 | - | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. | 133 | + | // MarkReady removes the draft prefix ("WIP:" or "[WIP]") from the title so |
| 134 | + | // the merge request can be merged. Needs the mr:write scope. Fails with | |||
| 135 | + | // failed_precondition if the merge request is not open or is not a draft. | |||
| 136 | + | // Publishes no event: there is none for a change of title. Needs the | |||
| 137 | + | // "merge_requests.ready" feature. | |||
| 138 | + | MarkReady(context.Context, *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) | |||
| 139 | + | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope, | |||
| 140 | + | // which merges only when the checks on the head allow it: none failed and | |||
| 141 | + | // none queued or running (a head with no checks may be merged; success, | |||
| 142 | + | // skipped and neutral pass). The mr:force-merge scope allows ignore_checks. | |||
| 131 | // The caller passes the head it reviewed: the server merges only if the | 143 | // The caller passes the head it reviewed: the server merges only if the | ||
| 132 | // source branch still points to it, so a push between review and merge is | 144 | // source branch still points to it, so a push between review and merge is | ||
| 133 | // never merged unseen. Fails with invalid_argument if head_id is empty or | 145 | // never merged unseen. Fails with invalid_argument if head_id is empty or | ||
| @@ -137,17 +149,17 @@ type MergeRequestServiceClient interface { | |||||
| 137 | // ancestor of the head (rebase and push again, or merge with squash or | 149 | // ancestor of the head (rebase and push again, or merge with squash or | ||
| 138 | // merge commit), if the mode is squash or merge commit and the head | 150 | // merge commit), if the mode is squash or merge commit and the head | ||
| 139 | // conflicts with the target or shares no history with it (rebase and push | 151 | // conflicts with the target or shares no history with it (rebase and push | ||
| 140 | - | // again), if the mode is not allowed by RepoSettings, or if a check fails | 152 | + | // again), if the mode is not allowed by RepoSettings, or if a check failed or |
| 141 | - | // and RepoSettings.failing_checks_block is set. Merges of one | 153 | + | // has not finished, unless ignore_checks is set. Merges of one |
| 142 | // repository run one at a time. Repeating a call that succeeded fails with | 154 | // repository run one at a time. Repeating a call that succeeded fails with | ||
| 143 | // failed_precondition (not open). On success the server publishes | 155 | // failed_precondition (not open). On success the server publishes | ||
| 144 | // MergeRequestMerged then Pushed for the target branch. | 156 | // MergeRequestMerged then Pushed for the target branch. | ||
| 145 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | 157 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | ||
| 146 | // EnableAutoMerge asks the server to merge an open merge request by itself | 158 | // EnableAutoMerge asks the server to merge an open merge request by itself | ||
| 147 | // once at least one check passed on its head, every run created on that head | 159 | // once at least one check passed on its head, every run created on that head | ||
| 148 | - | // is complete, and the merge would be accepted whatever | 160 | + | // is complete, and no check failed. It does not take ignore_checks. Needs |
| 149 | - | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | 161 | + | // the mr:merge scope and, for a token limited to branches, write access to |
| 150 | - | // token limited to branches, write access to the target branch | 162 | + | // the target branch |
| 151 | // (permission_denied otherwise). The server records the caller, the mode and | 163 | // (permission_denied otherwise). The server records the caller, the mode and | ||
| 152 | // the head the caller saw; it merges as the caller, after resolving the caller | 164 | // the head the caller saw; it merges as the caller, after resolving the caller | ||
| 153 | // again, and cancels the auto-merge if the caller can no longer merge, if the | 165 | // again, and cancels the auto-merge if the caller can no longer merge, if the | ||
| @@ -232,6 +244,12 @@ func NewMergeRequestServiceClient(httpClient connect.HTTPClient, baseURL string, | |||||
| 232 | connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), | 244 | connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), | ||
| 233 | connect.WithClientOptions(opts...), | 245 | connect.WithClientOptions(opts...), | ||
| 234 | ), | 246 | ), | ||
| 247 | + | markReady: connect.NewClient[ermite.MarkReadyRequest, ermite.MarkReadyResponse]( | |||
| 248 | + | httpClient, | |||
| 249 | + | baseURL+MergeRequestServiceMarkReadyProcedure, | |||
| 250 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("MarkReady")), | |||
| 251 | + | connect.WithClientOptions(opts...), | |||
| 252 | + | ), | |||
| 235 | mergeMergeRequest: connect.NewClient[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse]( | 253 | mergeMergeRequest: connect.NewClient[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse]( | ||
| 236 | httpClient, | 254 | httpClient, | ||
| 237 | baseURL+MergeRequestServiceMergeMergeRequestProcedure, | 255 | baseURL+MergeRequestServiceMergeMergeRequestProcedure, | ||
| @@ -269,6 +287,7 @@ type mergeRequestServiceClient struct { | |||||
| 269 | deleteComment *connect.Client[ermite.DeleteCommentRequest, ermite.DeleteCommentResponse] | 287 | deleteComment *connect.Client[ermite.DeleteCommentRequest, ermite.DeleteCommentResponse] | ||
| 270 | resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse] | 288 | resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse] | ||
| 271 | closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse] | 289 | closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse] | ||
| 290 | + | markReady *connect.Client[ermite.MarkReadyRequest, ermite.MarkReadyResponse] | |||
| 272 | mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse] | 291 | mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse] | ||
| 273 | enableAutoMerge *connect.Client[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse] | 292 | enableAutoMerge *connect.Client[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse] | ||
| 274 | cancelAutoMerge *connect.Client[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse] | 293 | cancelAutoMerge *connect.Client[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse] | ||
| @@ -315,6 +334,11 @@ func (c *mergeRequestServiceClient) CloseMergeRequest(ctx context.Context, req * | |||||
| 315 | return c.closeMergeRequest.CallUnary(ctx, req) | 334 | return c.closeMergeRequest.CallUnary(ctx, req) | ||
| 316 | } | 335 | } | ||
| 317 | 336 | ||||
| 337 | + | // MarkReady calls ermite.MergeRequestService.MarkReady. | |||
| 338 | + | func (c *mergeRequestServiceClient) MarkReady(ctx context.Context, req *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) { | |||
| 339 | + | return c.markReady.CallUnary(ctx, req) | |||
| 340 | + | } | |||
| 341 | + | ||||
| 318 | // MergeMergeRequest calls ermite.MergeRequestService.MergeMergeRequest. | 342 | // MergeMergeRequest calls ermite.MergeRequestService.MergeMergeRequest. | ||
| 319 | func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { | 343 | func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { | ||
| 320 | return c.mergeMergeRequest.CallUnary(ctx, req) | 344 | return c.mergeMergeRequest.CallUnary(ctx, req) | ||
| @@ -389,7 +413,16 @@ type MergeRequestServiceHandler interface { | |||||
| 389 | // the mr:write scope. Fails with failed_precondition if the merge request | 413 | // the mr:write scope. Fails with failed_precondition if the merge request | ||
| 390 | // is not open. A closed merge request cannot be reopened: open a new one. | 414 | // is not open. A closed merge request cannot be reopened: open a new one. | ||
| 391 | CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) | 415 | CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) | ||
| 392 | - | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. | 416 | + | // MarkReady removes the draft prefix ("WIP:" or "[WIP]") from the title so |
| 417 | + | // the merge request can be merged. Needs the mr:write scope. Fails with | |||
| 418 | + | // failed_precondition if the merge request is not open or is not a draft. | |||
| 419 | + | // Publishes no event: there is none for a change of title. Needs the | |||
| 420 | + | // "merge_requests.ready" feature. | |||
| 421 | + | MarkReady(context.Context, *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) | |||
| 422 | + | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope, | |||
| 423 | + | // which merges only when the checks on the head allow it: none failed and | |||
| 424 | + | // none queued or running (a head with no checks may be merged; success, | |||
| 425 | + | // skipped and neutral pass). The mr:force-merge scope allows ignore_checks. | |||
| 393 | // The caller passes the head it reviewed: the server merges only if the | 426 | // The caller passes the head it reviewed: the server merges only if the | ||
| 394 | // source branch still points to it, so a push between review and merge is | 427 | // source branch still points to it, so a push between review and merge is | ||
| 395 | // never merged unseen. Fails with invalid_argument if head_id is empty or | 428 | // never merged unseen. Fails with invalid_argument if head_id is empty or | ||
| @@ -399,17 +432,17 @@ type MergeRequestServiceHandler interface { | |||||
| 399 | // ancestor of the head (rebase and push again, or merge with squash or | 432 | // ancestor of the head (rebase and push again, or merge with squash or | ||
| 400 | // merge commit), if the mode is squash or merge commit and the head | 433 | // merge commit), if the mode is squash or merge commit and the head | ||
| 401 | // conflicts with the target or shares no history with it (rebase and push | 434 | // conflicts with the target or shares no history with it (rebase and push | ||
| 402 | - | // again), if the mode is not allowed by RepoSettings, or if a check fails | 435 | + | // again), if the mode is not allowed by RepoSettings, or if a check failed or |
| 403 | - | // and RepoSettings.failing_checks_block is set. Merges of one | 436 | + | // has not finished, unless ignore_checks is set. Merges of one |
| 404 | // repository run one at a time. Repeating a call that succeeded fails with | 437 | // repository run one at a time. Repeating a call that succeeded fails with | ||
| 405 | // failed_precondition (not open). On success the server publishes | 438 | // failed_precondition (not open). On success the server publishes | ||
| 406 | // MergeRequestMerged then Pushed for the target branch. | 439 | // MergeRequestMerged then Pushed for the target branch. | ||
| 407 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | 440 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | ||
| 408 | // EnableAutoMerge asks the server to merge an open merge request by itself | 441 | // EnableAutoMerge asks the server to merge an open merge request by itself | ||
| 409 | // once at least one check passed on its head, every run created on that head | 442 | // once at least one check passed on its head, every run created on that head | ||
| 410 | - | // is complete, and the merge would be accepted whatever | 443 | + | // is complete, and no check failed. It does not take ignore_checks. Needs |
| 411 | - | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | 444 | + | // the mr:merge scope and, for a token limited to branches, write access to |
| 412 | - | // token limited to branches, write access to the target branch | 445 | + | // the target branch |
| 413 | // (permission_denied otherwise). The server records the caller, the mode and | 446 | // (permission_denied otherwise). The server records the caller, the mode and | ||
| 414 | // the head the caller saw; it merges as the caller, after resolving the caller | 447 | // the head the caller saw; it merges as the caller, after resolving the caller | ||
| 415 | // again, and cancels the auto-merge if the caller can no longer merge, if the | 448 | // again, and cancels the auto-merge if the caller can no longer merge, if the | ||
| @@ -490,6 +523,12 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||||
| 490 | connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), | 523 | connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), | ||
| 491 | connect.WithHandlerOptions(opts...), | 524 | connect.WithHandlerOptions(opts...), | ||
| 492 | ) | 525 | ) | ||
| 526 | + | mergeRequestServiceMarkReadyHandler := connect.NewUnaryHandler( | |||
| 527 | + | MergeRequestServiceMarkReadyProcedure, | |||
| 528 | + | svc.MarkReady, | |||
| 529 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("MarkReady")), | |||
| 530 | + | connect.WithHandlerOptions(opts...), | |||
| 531 | + | ) | |||
| 493 | mergeRequestServiceMergeMergeRequestHandler := connect.NewUnaryHandler( | 532 | mergeRequestServiceMergeMergeRequestHandler := connect.NewUnaryHandler( | ||
| 494 | MergeRequestServiceMergeMergeRequestProcedure, | 533 | MergeRequestServiceMergeMergeRequestProcedure, | ||
| 495 | svc.MergeMergeRequest, | 534 | svc.MergeMergeRequest, | ||
| @@ -532,6 +571,8 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||||
| 532 | mergeRequestServiceResolveCommentHandler.ServeHTTP(w, r) | 571 | mergeRequestServiceResolveCommentHandler.ServeHTTP(w, r) | ||
| 533 | case MergeRequestServiceCloseMergeRequestProcedure: | 572 | case MergeRequestServiceCloseMergeRequestProcedure: | ||
| 534 | mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r) | 573 | mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r) | ||
| 574 | + | case MergeRequestServiceMarkReadyProcedure: | |||
| 575 | + | mergeRequestServiceMarkReadyHandler.ServeHTTP(w, r) | |||
| 535 | case MergeRequestServiceMergeMergeRequestProcedure: | 576 | case MergeRequestServiceMergeMergeRequestProcedure: | ||
| 536 | mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r) | 577 | mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r) | ||
| 537 | case MergeRequestServiceEnableAutoMergeProcedure: | 578 | case MergeRequestServiceEnableAutoMergeProcedure: | ||
| @@ -581,6 +622,10 @@ func (UnimplementedMergeRequestServiceHandler) CloseMergeRequest(context.Context | |||||
| 581 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CloseMergeRequest is not implemented")) | 622 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CloseMergeRequest is not implemented")) | ||
| 582 | } | 623 | } | ||
| 583 | 624 | ||||
| 625 | + | func (UnimplementedMergeRequestServiceHandler) MarkReady(context.Context, *connect.Request[ermite.MarkReadyRequest]) (*connect.Response[ermite.MarkReadyResponse], error) { | |||
| 626 | + | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkReady is not implemented")) | |||
| 627 | + | } | |||
| 628 | + | ||||
| 584 | func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { | 629 | func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { | ||
| 585 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented")) | 630 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented")) | ||
| 586 | } | 631 | } | ||
M gen/ermite/merge_request.pb.go +217 -91 generated file: collapsed
M gen/ermite/repo.pb.go +6 -19 generated file: collapsed
M gen/ermite/token.pb.go +10 -3 generated file: collapsed
M gen_test.go +2 -3
| @@ -254,10 +254,9 @@ func TestMergeRequestEventRoundTrip(t *testing.T) { | |||
| 254 | 254 | req := &ermite.UpdateRepoRequest{ | |
| 255 | 255 | Repo: "ermite", | |
| 256 | 256 | Settings: &ermite.RepoSettings{ | |
| 257 | - | AllowedMergeModes: []ermite.MergeMode{ermite.MergeMode_MERGE_MODE_SQUASH}, | |
| 258 | - | FailingChecksBlock: true, | |
| 257 | + | AllowedMergeModes: []ermite.MergeMode{ermite.MergeMode_MERGE_MODE_SQUASH}, | |
| 259 | 258 | }, | |
| 260 | - | UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"settings.allowed_merge_modes", "settings.failing_checks_block"}}, | |
| 259 | + | UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"settings.allowed_merge_modes"}}, | |
| 261 | 260 | } | |
| 262 | 261 | if got := req.GetSettings().GetAllowedMergeModes(); len(got) != 1 || got[0] != ermite.MergeMode_MERGE_MODE_SQUASH { | |
| 263 | 262 | t.Errorf("modes = %v", got) | |
| @@ -254,10 +254,9 @@ func TestMergeRequestEventRoundTrip(t *testing.T) { | |||||
| 254 | req := &ermite.UpdateRepoRequest{ | 254 | req := &ermite.UpdateRepoRequest{ | ||
| 255 | Repo: "ermite", | 255 | Repo: "ermite", | ||
| 256 | Settings: &ermite.RepoSettings{ | 256 | Settings: &ermite.RepoSettings{ | ||
| 257 | - | AllowedMergeModes: []ermite.MergeMode{ermite.MergeMode_MERGE_MODE_SQUASH}, | 257 | + | AllowedMergeModes: []ermite.MergeMode{ermite.MergeMode_MERGE_MODE_SQUASH}, |
| 258 | - | FailingChecksBlock: true, | |||
| 259 | }, | 258 | }, | ||
| 260 | - | UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"settings.allowed_merge_modes", "settings.failing_checks_block"}}, | 259 | + | UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"settings.allowed_merge_modes"}}, |
| 261 | } | 260 | } | ||
| 262 | if got := req.GetSettings().GetAllowedMergeModes(); len(got) != 1 || got[0] != ermite.MergeMode_MERGE_MODE_SQUASH { | 261 | if got := req.GetSettings().GetAllowedMergeModes(); len(got) != 1 || got[0] != ermite.MergeMode_MERGE_MODE_SQUASH { | ||
| 263 | t.Errorf("modes = %v", got) | 262 | t.Errorf("modes = %v", got) | ||
M proto/ermite/merge_request.proto +35 -6
| @@ -300,7 +300,16 @@ service MergeRequestService { | |||
| 300 | 300 | // the mr:write scope. Fails with failed_precondition if the merge request | |
| 301 | 301 | // is not open. A closed merge request cannot be reopened: open a new one. | |
| 302 | 302 | rpc CloseMergeRequest(CloseMergeRequestRequest) returns (CloseMergeRequestResponse); | |
| 303 | - | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. | |
| 303 | + | // MarkReady removes the draft prefix ("WIP:" or "[WIP]") from the title so | |
| 304 | + | // the merge request can be merged. Needs the mr:write scope. Fails with | |
| 305 | + | // failed_precondition if the merge request is not open or is not a draft. | |
| 306 | + | // Publishes no event: there is none for a change of title. Needs the | |
| 307 | + | // "merge_requests.ready" feature. | |
| 308 | + | rpc MarkReady(MarkReadyRequest) returns (MarkReadyResponse); | |
| 309 | + | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope, | |
| 310 | + | // which merges only when the checks on the head allow it: none failed and | |
| 311 | + | // none queued or running (a head with no checks may be merged; success, | |
| 312 | + | // skipped and neutral pass). The mr:force-merge scope allows ignore_checks. | |
| 304 | 313 | // The caller passes the head it reviewed: the server merges only if the | |
| 305 | 314 | // source branch still points to it, so a push between review and merge is | |
| 306 | 315 | // never merged unseen. Fails with invalid_argument if head_id is empty or | |
| @@ -310,17 +319,17 @@ service MergeRequestService { | |||
| 310 | 319 | // ancestor of the head (rebase and push again, or merge with squash or | |
| 311 | 320 | // merge commit), if the mode is squash or merge commit and the head | |
| 312 | 321 | // conflicts with the target or shares no history with it (rebase and push | |
| 313 | - | // again), if the mode is not allowed by RepoSettings, or if a check fails | |
| 314 | - | // and RepoSettings.failing_checks_block is set. Merges of one | |
| 322 | + | // again), if the mode is not allowed by RepoSettings, or if a check failed or | |
| 323 | + | // has not finished, unless ignore_checks is set. Merges of one | |
| 315 | 324 | // repository run one at a time. Repeating a call that succeeded fails with | |
| 316 | 325 | // failed_precondition (not open). On success the server publishes | |
| 317 | 326 | // MergeRequestMerged then Pushed for the target branch. | |
| 318 | 327 | rpc MergeMergeRequest(MergeMergeRequestRequest) returns (MergeMergeRequestResponse); | |
| 319 | 328 | // EnableAutoMerge asks the server to merge an open merge request by itself | |
| 320 | 329 | // once at least one check passed on its head, every run created on that head | |
| 321 | - | // is complete, and the merge would be accepted whatever | |
| 322 | - | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 323 | - | // token limited to branches, write access to the target branch | |
| 330 | + | // is complete, and no check failed. It does not take ignore_checks. Needs | |
| 331 | + | // the mr:merge scope and, for a token limited to branches, write access to | |
| 332 | + | // the target branch | |
| 324 | 333 | // (permission_denied otherwise). The server records the caller, the mode and | |
| 325 | 334 | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 326 | 335 | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| @@ -549,6 +558,21 @@ message CloseMergeRequestResponse { | |||
| 549 | 558 | MergeRequest merge_request = 1; | |
| 550 | 559 | } | |
| 551 | 560 | ||
| 561 | + | // MarkReadyRequest names the draft merge request to mark ready. | |
| 562 | + | message MarkReadyRequest { | |
| 563 | + | // Repo is the repository name. | |
| 564 | + | string repo = 1; | |
| 565 | + | // Number is the merge request number. | |
| 566 | + | int64 number = 2; | |
| 567 | + | } | |
| 568 | + | ||
| 569 | + | // MarkReadyResponse holds the merge request after marking it ready. | |
| 570 | + | message MarkReadyResponse { | |
| 571 | + | // MergeRequest is the merge request with its title stripped of the draft | |
| 572 | + | // prefix. | |
| 573 | + | MergeRequest merge_request = 1; | |
| 574 | + | } | |
| 575 | + | ||
| 552 | 576 | // MergeMergeRequestRequest describes the merge to perform. | |
| 553 | 577 | message MergeMergeRequestRequest { | |
| 554 | 578 | // Repo is the repository name. | |
| @@ -568,6 +592,11 @@ message MergeMergeRequestRequest { | |||
| 568 | 592 | // request. Servers without the "merge_requests.delete_branch" feature ignore | |
| 569 | 593 | // it. | |
| 570 | 594 | bool delete_source_branch = 5; | |
| 595 | + | // IgnoreChecks merges whatever the checks say. Needs the mr:force-merge | |
| 596 | + | // scope (permission_denied otherwise). Servers without the | |
| 597 | + | // "merge_requests.ignore_checks" feature ignore it: check the feature | |
| 598 | + | // before setting it. | |
| 599 | + | bool ignore_checks = 6; | |
| 571 | 600 | } | |
| 572 | 601 | ||
| 573 | 602 | // MergeMergeRequestResponse holds the merged merge request. | |
| @@ -300,7 +300,16 @@ service MergeRequestService { | |||||
| 300 | // the mr:write scope. Fails with failed_precondition if the merge request | 300 | // the mr:write scope. Fails with failed_precondition if the merge request | ||
| 301 | // is not open. A closed merge request cannot be reopened: open a new one. | 301 | // is not open. A closed merge request cannot be reopened: open a new one. | ||
| 302 | rpc CloseMergeRequest(CloseMergeRequestRequest) returns (CloseMergeRequestResponse); | 302 | rpc CloseMergeRequest(CloseMergeRequestRequest) returns (CloseMergeRequestResponse); | ||
| 303 | - | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. | 303 | + | // MarkReady removes the draft prefix ("WIP:" or "[WIP]") from the title so |
| 304 | + | // the merge request can be merged. Needs the mr:write scope. Fails with | |||
| 305 | + | // failed_precondition if the merge request is not open or is not a draft. | |||
| 306 | + | // Publishes no event: there is none for a change of title. Needs the | |||
| 307 | + | // "merge_requests.ready" feature. | |||
| 308 | + | rpc MarkReady(MarkReadyRequest) returns (MarkReadyResponse); | |||
| 309 | + | // MergeMergeRequest merges an open merge request. Needs the mr:merge scope, | |||
| 310 | + | // which merges only when the checks on the head allow it: none failed and | |||
| 311 | + | // none queued or running (a head with no checks may be merged; success, | |||
| 312 | + | // skipped and neutral pass). The mr:force-merge scope allows ignore_checks. | |||
| 304 | // The caller passes the head it reviewed: the server merges only if the | 313 | // The caller passes the head it reviewed: the server merges only if the | ||
| 305 | // source branch still points to it, so a push between review and merge is | 314 | // source branch still points to it, so a push between review and merge is | ||
| 306 | // never merged unseen. Fails with invalid_argument if head_id is empty or | 315 | // never merged unseen. Fails with invalid_argument if head_id is empty or | ||
| @@ -310,17 +319,17 @@ service MergeRequestService { | |||||
| 310 | // ancestor of the head (rebase and push again, or merge with squash or | 319 | // ancestor of the head (rebase and push again, or merge with squash or | ||
| 311 | // merge commit), if the mode is squash or merge commit and the head | 320 | // merge commit), if the mode is squash or merge commit and the head | ||
| 312 | // conflicts with the target or shares no history with it (rebase and push | 321 | // conflicts with the target or shares no history with it (rebase and push | ||
| 313 | - | // again), if the mode is not allowed by RepoSettings, or if a check fails | 322 | + | // again), if the mode is not allowed by RepoSettings, or if a check failed or |
| 314 | - | // and RepoSettings.failing_checks_block is set. Merges of one | 323 | + | // has not finished, unless ignore_checks is set. Merges of one |
| 315 | // repository run one at a time. Repeating a call that succeeded fails with | 324 | // repository run one at a time. Repeating a call that succeeded fails with | ||
| 316 | // failed_precondition (not open). On success the server publishes | 325 | // failed_precondition (not open). On success the server publishes | ||
| 317 | // MergeRequestMerged then Pushed for the target branch. | 326 | // MergeRequestMerged then Pushed for the target branch. | ||
| 318 | rpc MergeMergeRequest(MergeMergeRequestRequest) returns (MergeMergeRequestResponse); | 327 | rpc MergeMergeRequest(MergeMergeRequestRequest) returns (MergeMergeRequestResponse); | ||
| 319 | // EnableAutoMerge asks the server to merge an open merge request by itself | 328 | // EnableAutoMerge asks the server to merge an open merge request by itself | ||
| 320 | // once at least one check passed on its head, every run created on that head | 329 | // once at least one check passed on its head, every run created on that head | ||
| 321 | - | // is complete, and the merge would be accepted whatever | 330 | + | // is complete, and no check failed. It does not take ignore_checks. Needs |
| 322 | - | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | 331 | + | // the mr:merge scope and, for a token limited to branches, write access to |
| 323 | - | // token limited to branches, write access to the target branch | 332 | + | // the target branch |
| 324 | // (permission_denied otherwise). The server records the caller, the mode and | 333 | // (permission_denied otherwise). The server records the caller, the mode and | ||
| 325 | // the head the caller saw; it merges as the caller, after resolving the caller | 334 | // the head the caller saw; it merges as the caller, after resolving the caller | ||
| 326 | // again, and cancels the auto-merge if the caller can no longer merge, if the | 335 | // again, and cancels the auto-merge if the caller can no longer merge, if the | ||
| @@ -549,6 +558,21 @@ message CloseMergeRequestResponse { | |||||
| 549 | MergeRequest merge_request = 1; | 558 | MergeRequest merge_request = 1; | ||
| 550 | } | 559 | } | ||
| 551 | 560 | ||||
| 561 | + | // MarkReadyRequest names the draft merge request to mark ready. | |||
| 562 | + | message MarkReadyRequest { | |||
| 563 | + | // Repo is the repository name. | |||
| 564 | + | string repo = 1; | |||
| 565 | + | // Number is the merge request number. | |||
| 566 | + | int64 number = 2; | |||
| 567 | + | } | |||
| 568 | + | ||||
| 569 | + | // MarkReadyResponse holds the merge request after marking it ready. | |||
| 570 | + | message MarkReadyResponse { | |||
| 571 | + | // MergeRequest is the merge request with its title stripped of the draft | |||
| 572 | + | // prefix. | |||
| 573 | + | MergeRequest merge_request = 1; | |||
| 574 | + | } | |||
| 575 | + | ||||
| 552 | // MergeMergeRequestRequest describes the merge to perform. | 576 | // MergeMergeRequestRequest describes the merge to perform. | ||
| 553 | message MergeMergeRequestRequest { | 577 | message MergeMergeRequestRequest { | ||
| 554 | // Repo is the repository name. | 578 | // Repo is the repository name. | ||
| @@ -568,6 +592,11 @@ message MergeMergeRequestRequest { | |||||
| 568 | // request. Servers without the "merge_requests.delete_branch" feature ignore | 592 | // request. Servers without the "merge_requests.delete_branch" feature ignore | ||
| 569 | // it. | 593 | // it. | ||
| 570 | bool delete_source_branch = 5; | 594 | bool delete_source_branch = 5; | ||
| 595 | + | // IgnoreChecks merges whatever the checks say. Needs the mr:force-merge | |||
| 596 | + | // scope (permission_denied otherwise). Servers without the | |||
| 597 | + | // "merge_requests.ignore_checks" feature ignore it: check the feature | |||
| 598 | + | // before setting it. | |||
| 599 | + | bool ignore_checks = 6; | |||
| 571 | } | 600 | } | ||
| 572 | 601 | ||||
| 573 | // MergeMergeRequestResponse holds the merged merge request. | 602 | // MergeMergeRequestResponse holds the merged merge request. | ||
M proto/ermite/repo.proto +6 -8
| @@ -35,16 +35,14 @@ enum IssuesMode { | |||
| 35 | 35 | // RepoSettings are the settings of a repository that govern its merge | |
| 36 | 36 | // requests and issues. | |
| 37 | 37 | message RepoSettings { | |
| 38 | + | reserved 2; | |
| 39 | + | reserved "failing_checks_block"; | |
| 40 | + | ||
| 38 | 41 | // AllowedMergeModes are the modes with which a merge request of the | |
| 39 | 42 | // repository may be merged. It is never empty in a response and has no | |
| 40 | 43 | // duplicate. Every mode is allowed by default. MERGE_MODE_UNSPECIFIED is | |
| 41 | 44 | // rejected. | |
| 42 | 45 | repeated MergeMode allowed_merge_modes = 1; | |
| 43 | - | // FailingChecksBlock says whether a merge request whose checks fail cannot be | |
| 44 | - | // merged. It is true at creation of the repository and always stored | |
| 45 | - | // explicitly, so a later change of the server default never alters an | |
| 46 | - | // existing repository. | |
| 47 | - | bool failing_checks_block = 2; | |
| 48 | 46 | // Issues is the issue participation mode of the repository. | |
| 49 | 47 | IssuesMode issues = 3; | |
| 50 | 48 | // AllowAutoMerge says whether auto-merge can be enabled on the merge requests | |
| @@ -170,9 +168,9 @@ message UpdateRepoRequest { | |||
| 170 | 168 | // the call fails with failed_precondition. | |
| 171 | 169 | string default_branch = 4; | |
| 172 | 170 | // UpdateMask lists the fields to change: "description", "visibility", | |
| 173 | - | // "default_branch", "topics", "settings.allowed_merge_modes", | |
| 174 | - | // "settings.failing_checks_block" and/or "settings.allow_auto_merge". | |
| 175 | - | // "settings" stands for the three merge settings paths. It must not be empty unless issues is set. Other paths are | |
| 171 | + | // "default_branch", "topics", "settings.allowed_merge_modes" and/or | |
| 172 | + | // "settings.allow_auto_merge". "settings" stands for the two merge settings | |
| 173 | + | // paths. It must not be empty unless issues is set. Other paths are | |
| 176 | 174 | // invalid_argument, including "settings.issues" and "issues": the issues | |
| 177 | 175 | // field is applied outside the mask. | |
| 178 | 176 | google.protobuf.FieldMask update_mask = 5; | |
| @@ -35,16 +35,14 @@ enum IssuesMode { | |||||
| 35 | // RepoSettings are the settings of a repository that govern its merge | 35 | // RepoSettings are the settings of a repository that govern its merge | ||
| 36 | // requests and issues. | 36 | // requests and issues. | ||
| 37 | message RepoSettings { | 37 | message RepoSettings { | ||
| 38 | + | reserved 2; | |||
| 39 | + | reserved "failing_checks_block"; | |||
| 40 | + | ||||
| 38 | // AllowedMergeModes are the modes with which a merge request of the | 41 | // AllowedMergeModes are the modes with which a merge request of the | ||
| 39 | // repository may be merged. It is never empty in a response and has no | 42 | // repository may be merged. It is never empty in a response and has no | ||
| 40 | // duplicate. Every mode is allowed by default. MERGE_MODE_UNSPECIFIED is | 43 | // duplicate. Every mode is allowed by default. MERGE_MODE_UNSPECIFIED is | ||
| 41 | // rejected. | 44 | // rejected. | ||
| 42 | repeated MergeMode allowed_merge_modes = 1; | 45 | repeated MergeMode allowed_merge_modes = 1; | ||
| 43 | - | // FailingChecksBlock says whether a merge request whose checks fail cannot be | |||
| 44 | - | // merged. It is true at creation of the repository and always stored | |||
| 45 | - | // explicitly, so a later change of the server default never alters an | |||
| 46 | - | // existing repository. | |||
| 47 | - | bool failing_checks_block = 2; | |||
| 48 | // Issues is the issue participation mode of the repository. | 46 | // Issues is the issue participation mode of the repository. | ||
| 49 | IssuesMode issues = 3; | 47 | IssuesMode issues = 3; | ||
| 50 | // AllowAutoMerge says whether auto-merge can be enabled on the merge requests | 48 | // AllowAutoMerge says whether auto-merge can be enabled on the merge requests | ||
| @@ -170,9 +168,9 @@ message UpdateRepoRequest { | |||||
| 170 | // the call fails with failed_precondition. | 168 | // the call fails with failed_precondition. | ||
| 171 | string default_branch = 4; | 169 | string default_branch = 4; | ||
| 172 | // UpdateMask lists the fields to change: "description", "visibility", | 170 | // UpdateMask lists the fields to change: "description", "visibility", | ||
| 173 | - | // "default_branch", "topics", "settings.allowed_merge_modes", | 171 | + | // "default_branch", "topics", "settings.allowed_merge_modes" and/or |
| 174 | - | // "settings.failing_checks_block" and/or "settings.allow_auto_merge". | 172 | + | // "settings.allow_auto_merge". "settings" stands for the two merge settings |
| 175 | - | // "settings" stands for the three merge settings paths. It must not be empty unless issues is set. Other paths are | 173 | + | // paths. It must not be empty unless issues is set. Other paths are |
| 176 | // invalid_argument, including "settings.issues" and "issues": the issues | 174 | // invalid_argument, including "settings.issues" and "issues": the issues | ||
| 177 | // field is applied outside the mask. | 175 | // field is applied outside the mask. | ||
| 178 | google.protobuf.FieldMask update_mask = 5; | 176 | google.protobuf.FieldMask update_mask = 5; | ||
M proto/ermite/token.proto +5 -1
| @@ -23,7 +23,8 @@ enum Scope { | |||
| 23 | 23 | // SCOPE_MR_WRITE allows creating, commenting on and closing merge requests. | |
| 24 | 24 | // Wire name: mr:write. | |
| 25 | 25 | SCOPE_MR_WRITE = 4; | |
| 26 | - | // SCOPE_MR_MERGE allows merging merge requests. Wire name: mr:merge. | |
| 26 | + | // SCOPE_MR_MERGE allows merging merge requests whose checks allow it. Wire name: | |
| 27 | + | // mr:merge. | |
| 27 | 28 | SCOPE_MR_MERGE = 5; | |
| 28 | 29 | // SCOPE_CI_WRITE allows re-running or cancelling CI runs. Wire name: | |
| 29 | 30 | // ci:write. | |
| @@ -45,6 +46,9 @@ enum Scope { | |||
| 45 | 46 | // SCOPE_ISSUE_WRITE allows creating, commenting on, closing and reopening | |
| 46 | 47 | // issues. Wire name: issue:write. | |
| 47 | 48 | SCOPE_ISSUE_WRITE = 11; | |
| 49 | + | // SCOPE_MR_FORCE_MERGE allows merging a merge request whatever its checks | |
| 50 | + | // say (MergeMergeRequestRequest.ignore_checks). Wire name: mr:force-merge. | |
| 51 | + | SCOPE_MR_FORCE_MERGE = 12; | |
| 48 | 52 | } | |
| 49 | 53 | ||
| 50 | 54 | // Token describes a stored token. It never contains the secret nor its hash. | |
| @@ -23,7 +23,8 @@ enum Scope { | |||||
| 23 | // SCOPE_MR_WRITE allows creating, commenting on and closing merge requests. | 23 | // SCOPE_MR_WRITE allows creating, commenting on and closing merge requests. | ||
| 24 | // Wire name: mr:write. | 24 | // Wire name: mr:write. | ||
| 25 | SCOPE_MR_WRITE = 4; | 25 | SCOPE_MR_WRITE = 4; | ||
| 26 | - | // SCOPE_MR_MERGE allows merging merge requests. Wire name: mr:merge. | 26 | + | // SCOPE_MR_MERGE allows merging merge requests whose checks allow it. Wire name: |
| 27 | + | // mr:merge. | |||
| 27 | SCOPE_MR_MERGE = 5; | 28 | SCOPE_MR_MERGE = 5; | ||
| 28 | // SCOPE_CI_WRITE allows re-running or cancelling CI runs. Wire name: | 29 | // SCOPE_CI_WRITE allows re-running or cancelling CI runs. Wire name: | ||
| 29 | // ci:write. | 30 | // ci:write. | ||
| @@ -45,6 +46,9 @@ enum Scope { | |||||
| 45 | // SCOPE_ISSUE_WRITE allows creating, commenting on, closing and reopening | 46 | // SCOPE_ISSUE_WRITE allows creating, commenting on, closing and reopening | ||
| 46 | // issues. Wire name: issue:write. | 47 | // issues. Wire name: issue:write. | ||
| 47 | SCOPE_ISSUE_WRITE = 11; | 48 | SCOPE_ISSUE_WRITE = 11; | ||
| 49 | + | // SCOPE_MR_FORCE_MERGE allows merging a merge request whatever its checks | |||
| 50 | + | // say (MergeMergeRequestRequest.ignore_checks). Wire name: mr:force-merge. | |||
| 51 | + | SCOPE_MR_FORCE_MERGE = 12; | |||
| 48 | } | 52 | } | ||
| 49 | 53 | ||||
| 50 | // Token describes a stored token. It never contains the secret nor its hash. | 54 | // Token describes a stored token. It never contains the secret nor its hash. | ||