runatlantis / atlantis

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

Atlantis merges the PR even when the "atlantis apply" fails. #4635

Open snehalsn opened 4 weeks ago

snehalsn commented 4 weeks ago

Community Note

Overview of the Issue

We have noticed that there are instances where atlantis goes ahead with merging a PR in the event of an apply error which seems to be a bug in the system. Ideally, when the atlantis apply results in an error, it should not merge the PR.

Screenshot :

Screenshot 2024-06-06 at 2 43 41 PM

Reproduction Steps

  1. Raised the PR
  2. Ran atlantis plan which showed the expected changes.
  3. Ran atlantis apply . This resulted in the Apply Failed error stating "Pull request must be mergeable before running apply." It should have stopped at this stage on failure, however, atlantis went ahead and merged the PR.

Environment details

Atlantis server-side config file: We use upstream server-side config

Repo atlantis.yaml file:

 - name: <project_name>
    dir: <directory_path>
    workspace: <workspace_name>
    terraform_version: "1.3.9"
    autoplan:
      when_modified: ["*.tf", "**/*.tf"]
      enabled: true
jamengual commented 3 weeks ago

are the status required for merging? if not then it will not care.

snehalsn commented 2 weeks ago

yes... if the apply fails, then the PR should not be merged.

jamengual commented 2 weeks ago

Which VCS do you use?

snehalsn commented 2 weeks ago

Github