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

feat: Clarify approved vs mergeable for gitlab #3830

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lukemassa
Copy link
Contributor

what

why

Per #2605, gitlab does not respect the approved the way users would expect, i.e. has someone clicked the "approved" button. This is how the other VCSs interpret approved.

The current implementation for gitlab is closer to "are approval rules passing". That's what I thought "approved" meant when I implemented #3744 (since I'm most familiar with gitlab).

However, looking closer, it turns out:

  • The other VCSs treat this as "someone other than the author clicked approve"
  • gitlab itself already implements "follows approval rules" (it asserts that mr.ApprovalsBeforeMerge <= 0)

Thus there was this inconsistency, plus it meant that approved was strictly weaker than mergeable for gitlab.

The theory here I think is that it is nice to have one knob for users to turn that means "a user needs to approve this" vs "a user needs to approve this if the project thinks a user needs to approve this".

I personally will only use mergeable in my setup, since I have tight control over all the repos, but without a change like this, there's no way to implement #2605 , and force workflows to have approvals from the "atlantis side".

tests

Before:

apply_requirements Project has MR Approval Rule Project does not have MR Approval Rule
[] Does not require approval Does not require approval
[approved] Requires approval Does not require approval
[mergeable] Requires approval Does not require approval
[approved, mergeable] Requires approval Does not require approval

After:

apply_requirements Project has MR Approval Rule Project does not have MR Approval Rule
[] Does not require approval Does not require approval
[approved] Requires approval Requires approval
[mergeable] Requires approval Does not require approval
[approved, mergeable] Requires approval Requires approval

As you can see from the above, the functional change here is, for projects that do not have an MR Approval Rule, setting approved requires approval.

references

reverts #3744
closes: #2605

@lukemassa lukemassa marked this pull request as ready for review October 7, 2023 14:56
@lukemassa lukemassa requested a review from a team as a code owner October 7, 2023 14:56
@github-actions github-actions bot added docs Documentation go Pull requests that update Go code provider/gitlab labels Oct 7, 2023
@jamengual jamengual added the waiting-on-review Waiting for a review from a maintainer label Oct 10, 2023
@jamengual
Copy link
Contributor

@GenPage

@lukemassa
Copy link
Contributor Author

Discussed this at office hours today, and @GenPage asked me to add a comment about the impact of this change.

If merged, this would be a breaking change for gitlab users who use the approved command requirement and who have repos that do not have approval rules. Commands in those repos would begin saying "Pull request must be approved by at least one person other than the author before running ". If users don't want to require approvals, they can remove approved. If they want approval rules to be evaluated, they can add mergeable (which respects approval rules, and whose implementation has not been changed by this PR).

@jamengual jamengual added this to the v0.28.0 milestone Nov 15, 2023
@lukemassa lukemassa requested a review from a team as a code owner December 30, 2023 17:01
@lukemassa lukemassa requested review from nitrocode and X-Guardian and removed request for a team December 30, 2023 17:01
@chenrui333 chenrui333 modified the milestones: v0.28.0, v0.29.0 May 22, 2024
@GenPage GenPage added feature New functionality/enhancement and removed docs Documentation labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement go Pull requests that update Go code provider/gitlab waiting-on-review Waiting for a review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

apply_requirements not being evaluated
5 participants