feat(projects): manage merge request approval configuration on Project - #395
Conversation
5820f2c to
31204ab
Compare
GitLab exposes project-level merge request approval settings (reset-on-push, author/committer self-approval, reauthentication, etc.) through a dedicated /projects/:id/approvals endpoint that is separate from the main project update API. Expose it as an optional `approvals` block on the existing Project resource, following the same pattern as `pushRules`, rather than a separate CRD, since it has no independent identity or lifecycle apart from the project it belongs to. Fields are only reconciled when `approvals` is set in the spec, so existing Project resources are unaffected. Signed-off-by: Alexandre Allard <alexandre.allard@proton.ch>
31204ab to
32934f5
Compare
|
@alexandre-allard Thanks for this contribution. The embedded One behavior should be clarified before merging. The API comments and example currently say that fields left unset inside Codecov is also failing, but its baseline appears stale: it compares against Separately, approvals are applied only through |
Description of your changes
GitLab exposes project-level merge request approval settings (reset-on-push, author/committer self-approval, reauthentication, etc.) through a dedicated
/projects/:id/approvalsendpoint that is separate from the main project update API.This adds an optional
approvalsblock on the existingProjectresource, following the same pattern aspushRules, rather than introducing a separate CRD, since these settings have no independent identity or lifecycle apart from the project they belong to.Fields are only reconciled when
approvalsis set in the spec, so existingProjectresources are unaffected.approvalsBeforeMergeis intentionally left out of the newapprovalsblock, it's already managed via the existing top-levelProjectParameters.approvalsBeforeMergefield (a different GitLab API), and duplicating it here would create two reconciliation paths for the same underlying setting.Note on design:
I went back and forth on whether this should be a separate CRD (similar to the existing
ApprovalRuleresource) instead of a field onProject.I ended up embedding it because these settings have no identity or lifecycle independent of the project they belong to, but I'm not fully set on this, so happy to split it out into its own resource if maintainers prefer that instead.
I have:
make reviewable testto ensure this PR is ready for review.How has this code been tested
Tested it on one of our clusters with real data and we're currently using it in production.