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

Atlantis can apply un-mergeable MRs #5124

Open
yertym opened this issue Nov 27, 2024 · 1 comment
Open

Atlantis can apply un-mergeable MRs #5124

yertym opened this issue Nov 27, 2024 · 1 comment
Labels
bug Something isn't working provider/gitlab

Comments

@yertym
Copy link

yertym commented Nov 27, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

When using a gitlab project with the merge commit with semi-linear history an MR source branch must be rebased if it's not up to date with the current target branch revision. Gitlab will refuse to merge the branch until the branch is rebased but atlantis will apply the change and then be unable to merge.

The behaviour was changed in #4402 and the linked issue #4390 suggests this was correcting the behaviour back to how it was prior to the needs_rebase merge status being introduced.

It seems to contradict the apply_requirement of mergeable

Reproduction Steps

  1. Create a MR with a source branch that is not based on the latest commit of the target branch
  2. Comment atlantis apply

Environment details

  • Atlantis version: 0.31.0
  • Deployment method: helm chart on EKS
  • Atlantis flags:

Atlantis server-side config file:

---
    repos:
    - id: "/.*/"
      apply_requirements: [approved, mergeable]
      allowed_overrides: [workflow]
      delete_source_branch_on_merge: true
@yertym yertym added the bug Something isn't working label Nov 27, 2024
Copy link

dosubot bot commented Nov 27, 2024

Hey @yertym! I'm here to assist you with any bugs, questions, or contributions. Let's dive into this issue together!

I found some relevant threads that might help with the issue you're experiencing:

  1. Closed Issue: Atlantis Apply Fails on GitLab v16.10 When the Merge Request Branch Needs Rebasing. This issue was resolved by a pull request that aimed to fix the behavior when a merge request branch needs rebasing [1].

  2. Closed Issue: apply fails with apply_requirements mergeable on gitlab < 15.6. This was resolved by adding a backwards-compatible mergeability check [2].

  3. Open Issue: There is a suggestion to manually update the commit status of a "stuck" Atlantis plan job to "success" using the GitLab commit status API as a workaround for merge request status issues [3].

The behavior you're observing, where Atlantis applies changes to un-mergeable merge requests, seems to contradict the apply_requirements of mergeable. This might be related to how the needs_rebase status is handled. The pull request #4402 aimed to address issues related to this status, potentially reverting behavior to how it was before the needs_rebase status was introduced [1].

If the issue persists, you might want to check if the logic in the PullIsMergeable function aligns with your expectations and whether the merge commit with semi-linear history setting in GitLab is affecting the mergeability checks [4].

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working provider/gitlab
Projects
None yet
Development

No branches or pull requests

1 participant