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 4 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
@lukemassa lukemassa force-pushed the clarify_approved_vs_mergeable branch 2 times, most recently from e61cf94 to 7650ac8 Compare December 30, 2023 17:36
@chenrui333 chenrui333 modified the milestones: v0.28.0, v0.29.0 May 22, 2024
chenrui333
chenrui333 previously approved these changes May 23, 2024
@GenPage GenPage added feature New functionality/enhancement and removed docs Documentation labels Jun 26, 2024
@X-Guardian X-Guardian removed this from the v0.29.0 milestone Dec 17, 2024
@jamengual
Copy link
Contributor

@lukemassa, could you sign the commits and fix the conflicts to merge this? Thanks.

@jamengual jamengual added the waiting-on-response Waiting for a response from the user label Dec 31, 2024
Copy link

github-actions bot commented Feb 3, 2025

This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.

@github-actions github-actions bot added the Stale label Feb 3, 2025
@github-actions github-actions bot removed the Stale label Feb 22, 2025
@lukemassa lukemassa force-pushed the clarify_approved_vs_mergeable branch from 9c6d182 to ea34c57 Compare February 24, 2025 00:33
@github-actions github-actions bot added the docs Documentation label Feb 24, 2025
@lukemassa lukemassa force-pushed the clarify_approved_vs_mergeable branch from ea34c57 to fbd252f Compare February 24, 2025 00:36
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
@lukemassa lukemassa force-pushed the clarify_approved_vs_mergeable branch from 82a9c5b to 2e82965 Compare February 24, 2025 00:38
@lukemassa
Copy link
Contributor Author

UPDATE: I rebased and signed off on the commit. A lot of time has passed here; I no longer use gitlab so I don't quite feel qualified to say whether this is a step forward or not for gitlab. If gitlab users still think this makes sense I'm fine having it merged.

Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
@lukemassa lukemassa force-pushed the clarify_approved_vs_mergeable branch from 9c5a463 to ce12259 Compare March 4, 2025 04:28
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
@lukemassa lukemassa force-pushed the clarify_approved_vs_mergeable branch from d480dc8 to 4fd6d5a Compare March 4, 2025 05:13
Copy link

github-actions bot commented Apr 6, 2025

This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.

@github-actions github-actions bot added the Stale label Apr 6, 2025
@jamengual jamengual removed the Stale label Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation feature New functionality/enhancement go Pull requests that update Go code provider/gitlab waiting-on-response Waiting for a response from the user 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