runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.68k stars 1.05k forks source link

Atlantis apply succeeds on unmergeable MR with apply_requirements mergeable in Gitlab #4025

Open Balsir opened 9 months ago

Balsir commented 9 months ago

Community Note

Reproduction Steps

  1. Configure checkout strategy merge and apply_requirements approved, mergeable, undiverged
  2. In Gitlab repo, set Merge method to Merge commit with semi-linear history.
  3. Create merge request and run atlantis plan
  4. Change a different file and push directly to main. The following should show up on the merge request, preventing merging. image
  5. Run atlantis apply. The apply succeeds. I would expect it to fail until rebase is completed.

    Environment details

    • Atlantis version: v0.26.0
    • Deployment method: helm
    • Gitlab version v16.5.1-ee

Atlantis server-side config file:

repos:
- apply_requirements:
  - approved
  - mergeable
  - undiverged
  id: /.*/

Repo atlantis.yaml file:

version: 3
parallel_plan: true
parallel_apply: true
projects:
  - name: terraform
    dir: terraform
    autoplan:
      when_modified: [ "*.tf" ]
    terraform_version: 1.5.6
dorian-tsorfy commented 1 month ago

Hello I tried to reproduce this issue in version v0.28.5 of Atlantis and my apply was failed with error - Apply Failed: Default branch must be rebased onto pull request before running apply.. This is a good behavior, try and check again and tell me if the issue still exist