Bug Description
When running multiple Atlantis instances watching the same repository with automerge enabled, each instance independently decides to merge the PR once its own plans are all applied — without checking whether other instances still have unapplied plans. This causes premature merges, leaving plans from other instances unapplied.
Reproduction Steps
- Configure 2+ Atlantis instances watching the same repo (e.g., Instance A manages
infra/networking/, Instance B manages infra/compute/)
- Enable
automerge: true on all instances
- Create a PR that modifies root modules managed by both instances
- Selectively apply plans one instance at a time — e.g., apply all Instance A plans first
- Observe: Instance A merges the PR immediately after its plans are applied, even though Instance B still has unapplied plans
Expected Behavior
The PR should only be merged when all plans across all Atlantis instances have been successfully applied. Automerge should be aware of (or defer to) the state of other instances.
Actual Behavior
The first instance to complete all of its own applies triggers the merge, ignoring unapplied plans from other instances. This can lead to:
- Unapplied infrastructure changes that were planned but never applied
- Drift between the planned state and actual infrastructure
- Silent failures where team members assume all changes were applied
Environment
- Atlantis version: affects current versions with automerge enabled
- Multiple Atlantis instances watching the same repository
- Automerge enabled on all instances
Possible Solutions
- Cross-instance awareness: Atlantis could check GitHub commit statuses/checks from all instances before triggering automerge
- Documentation update: At minimum, warn users that automerge is not safe with multi-instance setups (update automerge docs)
- Post-workflow hook pattern: Provide guidance on using a post-apply webhook that checks all commit statuses before triggering merge via API
Related
Bug Description
When running multiple Atlantis instances watching the same repository with automerge enabled, each instance independently decides to merge the PR once its own plans are all applied — without checking whether other instances still have unapplied plans. This causes premature merges, leaving plans from other instances unapplied.
Reproduction Steps
infra/networking/, Instance B managesinfra/compute/)automerge: trueon all instancesExpected Behavior
The PR should only be merged when all plans across all Atlantis instances have been successfully applied. Automerge should be aware of (or defer to) the state of other instances.
Actual Behavior
The first instance to complete all of its own applies triggers the merge, ignoring unapplied plans from other instances. This can lead to:
Environment
Possible Solutions
Related