Automerging
Atlantis can be configured to automatically merge a pull request after all plans have been successfully applied.
How To Enable
Automerging can be enabled either by:
Passing the
--automerge
flag toatlantis server
. This sets the parameter globally; however, explicit declaration in the repo config will be respected and take priority.Setting
automerge: true
in the repo'satlantis.yaml
file:yamlversion: 3 automerge: true projects: - dir: .
NOTE
If a repo has an
atlantis.yaml
file, then each project in the repo needs to be configured under theprojects
key.
How to Disable
If automerge is enabled, you can disable it for a single atlantis apply
command with the --auto-merge-disabled
option.
How to set the merge method for automerge
If automerge is enabled, you can use the --auto-merge-method
option for the atlantis apply
command to specify which merge method use.
atlantis apply --auto-merge-method <method>
The method
must be one of:
- merge
- rebase
- squash
This is currently only implemented for the GitHub VCS.
Requirements
All Plans Must Succeed
When automerge is enabled, all plans in a pull request must succeed before any plans can be applied.
For example, imagine this scenario:
- I open a pull request that makes changes to two Terraform projects, in
dir1/
anddir2/
. - The plan for
dir2/
fails because my Terraform syntax is wrong.
In this scenario, I can't run
atlantis apply -d dir1
Even though that plan succeeded, because all plans must succeed for any plans to be saved.
Once I fix the issue in dir2
, I can push a new commit which will trigger an autoplan. Then I will be able to apply both plans.
All Plans must be applied
If multiple projects/dirs/workspaces are configured to be planned automatically, then they should all be applied before Atlantis automatically merges the PR.
Permissions
The Atlantis VCS user must have the ability to merge pull requests.