You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Atlantis auto merge after apply fails when GitHub repo is configured to require atlantis/apply check to pass before allowing merge. Seems like a race condition when Atlantis tries to merge PR before GitHub realises that atlantis/apply check has passed and unblocks merge.
Reproduction Steps
Enable auto merge in Atlantis server config ATLANTIS_AUTOMERGE=true
Set apply_requirements: [approved, undiverged] in server side config
Set GitHub branch protection rules to require atlantis/apply check to pass before allowing merge
5. Run standard Atlantis workflow for pull request
Logs
Logs
{"level":"info","ts":"2023-03-15T13:04:45.139Z","caller":"events/events_controller.go:545","msg":"parsed comment as command=\"apply\" verbose=false dir=\"\" workspace=\"\" project=\"\" flags=\"\"","json":{"gh-request-id":"X-Github-Delivery=f4627360-c331-11ed-840a-b249a2a93464"}}
{"level":"info","ts":"2023-03-15T13:04:47.272Z","caller":"terraform/terraform_client.go:361","msg":"Detected module requires version: 1.4.0","json":{"repo":"<redacted>/terraform-infrastructure","pull":"6"}}
{"level":"info","ts":"2023-03-15T13:04:47.538Z","caller":"runtime/apply_step_runner.go:39","msg":"starting apply","json":{"repo":"<redacted>/terraform-infrastructure","pull":"6"}}
{"level":"info","ts":"2023-03-15T13:04:53.582Z","caller":"models/shell_command_runner.go:156","msg":"successfully ran \"/home/atlantis/.atlantis/bin/terraform1.4.0 apply -input=false \\\"/home/atlantis/.atlantis/repos/<redacted>/terraform-infrastructure/6/default/<redacted>/<redacted>-default.tfplan\\\"\" in \"/home/atlantis/.atlantis/repos/<redacted>/terraform-infrastructure/6/default/<redacted>\"","json":{"repo":"<redacted>/terraform-infrastructure","pull":"6"}}
{"level":"info","ts":"2023-03-15T13:04:53.582Z","caller":"runtime/apply_step_runner.go:58","msg":"apply successful, deleting planfile","json":{"repo":"<redacted>/terraform-infrastructure","pull":"6"}}
{"level":"info","ts":"2023-03-15T13:04:53.832Z","caller":"events/instrumented_project_command_runner.go:87","msg":"apply success. output available at: https://github.com/<redacted>/terraform-infrastructure/pull/6","json":{"repo":"<redacted>/terraform-infrastructure","pull":"6"}}
{"level":"info","ts":"2023-03-15T13:04:56.578Z","caller":"events/automerger.go:32","msg":"automerging pull request","json":{"repo":"<redacted>/terraform-infrastructure","pull":"6"}}
{"level":"error","ts":"2023-03-15T13:04:57.450Z","caller":"vcs/instrumented_client.go:231","msg":"Unable to merge pull, error: merging pull request: PUT https://api.github.com/repos/<redacted>/terraform-infrastructure/pulls/6/merge: 405 This branch must not contain merge commits. []","json":{"pull-num":6},"stacktrace":"github.com/runatlantis/atlantis/server/events/vcs.(*InstrumentedClient).MergePull\n\tgithub.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:231\ngithub.com/runatlantis/atlantis/server/events/vcs.(*ClientProxy).MergePull\n\tgithub.com/runatlantis/atlantis/server/events/vcs/proxy.go:84\ngithub.com/runatlantis/atlantis/server/events.(*AutoMerger).automerge\n\tgithub.com/runatlantis/atlantis/server/events/automerger.go:35\ngithub.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/apply_command_runner.go:183\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:296"}
Community Note
Overview of the Issue
Atlantis auto merge after apply fails when GitHub repo is configured to require
atlantis/apply
check to pass before allowing merge. Seems like a race condition when Atlantis tries to merge PR before GitHub realises thatatlantis/apply
check has passed and unblocks merge.Reproduction Steps
ATLANTIS_AUTOMERGE=true
apply_requirements: [approved, undiverged]
in server side configatlantis/apply
check to pass before allowing merge5. Run standard Atlantis workflow for pull request
Logs
Logs
Environment details
atlantis.yaml
file:Additional Context
The text was updated successfully, but these errors were encountered: