Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitlab auto merge race condition #1609

Closed
michelmzs opened this issue May 31, 2021 · 2 comments
Closed

Gitlab auto merge race condition #1609

michelmzs opened this issue May 31, 2021 · 2 comments

Comments

@michelmzs
Copy link
Contributor

michelmzs commented May 31, 2021

We experienced a behavior when the Gitlab option Pipelines must succeed is enabled and the Atlantis auto-merge option either. Sometimes the Atlantis PUT request for merging the MR returns 405 Method Not Allowed.

Analyzing the problem in our environment, apparently, the situation occurs because the auto-merge command on Atlantis does not check the mergeability status or the external pipeline status before executing.

Anyone else experienced that behavior?

Update:
We did a patch adding a sleep time before the automerge(), and until now the error rate dropped to below 2%.

@swade1987
Copy link

swade1987 commented Jun 7, 2021

We have also been experiencing this since moving to 0.16 and also with our move to 0.17 as well (see below)

Screenshot 2021-06-02 at 16 45 49

We have placed Atlantis into debug mode and only get the following output

{
    "level": "error",
    "ts": 1622712784.8012686,
    "caller": "events/automerger.go:37",
    "msg": "automerging failed: unable to merge merge request, it may not be in a mergeable state: PUT https://gitlab.com/api/v4/projects/redacted/tf-env-security-groups/merge_requests/39/merge: 405 {message: 405 Method Not Allowed}",
    "json": {
        "repo": "redacted/tf-env-security-groups",
        "pull": "39"
    },
    "stacktrace": "github.com/runatlantis/atlantis/server/events.(*AutoMerger).automerge\n\t/home/circleci/project/server/events/automerger.go:37\ngithub.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\t/home/circleci/project/server/events/apply_command_runner.go:161\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\t/home/circleci/project/server/events/command_runner.go:212"
}

@devlucasc
Copy link
Contributor

I did this fix here #1675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants