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

Automerge not working with Bitbucket Server #465

Closed
philslab-ninja opened this issue Feb 10, 2019 · 4 comments
Closed

Automerge not working with Bitbucket Server #465

philslab-ninja opened this issue Feb 10, 2019 · 4 comments
Labels
bug Something isn't working provider/bitbucket

Comments

@philslab-ninja
Copy link

philslab-ninja commented Feb 10, 2019

When using automerge with Bitbucket Server this happens:

Automerging failed: making request "POST http://bitbucket-on-prem.example.org:7990/rest/api/1.0/projects/exampleproject/repos/examplerepo/pull-requests/1/merge" unexpected status code: 403, body: XSRF check failed

Seems to be fixable by adding X-Atlassian-Token header to each request, setting the value to no-check. see: https://confluence.atlassian.com/cloudkb/xsrf-check-failed-when-calling-cloud-apis-826874382.html

lkysow added a commit that referenced this issue Feb 11, 2019
Fixes #465 which is caused by XSRF detection on Bitbucket server and
cloud.
@lkysow
Copy link
Member

lkysow commented Feb 11, 2019

@philslab-ninja I've released https://github.com/runatlantis/atlantis/releases/tag/v0.4.15 with what is hopefully a fix. Can you test it for me please?

@lkysow lkysow added the waiting-on-response Waiting for a response from the user label Feb 11, 2019
@philslab-ninja
Copy link
Author

philslab-ninja commented Feb 12, 2019

Hi,

I can confirm this issue is resolved.

Unfortunately a new issue has shown now, when the merge is being done this error happens:

Automerging failed: making request "POST http://xxx:7990/rest/api/1.0/projects/xxx/repos/xxx/pull-requests/2/merge" unexpected status code: 409, body: {"errors":[{"context":null,"message":"You are attempting to modify a pull request based on out-of-date information.","exceptionName":"com.atlassian.bitbucket.pull.PullRequestOutOfDateException","currentVersion":1,"expectedVersion":-1,"pullRequest":{"id":2,"version":1,"title":"Testing Atlantis Automerge" (...)

Seems this only affects bitbucket server (on-prem) and seems to be fixable by first polling for the current PR version, then using that version in the merge call.

see: https://confluence.atlassian.com/bitbucketserverkb/bitbucket-server-rest-api-for-merging-pull-request-fails-792309002.html

Thanks so much!

@philslab-ninja
Copy link
Author

I will open a seperate issue for this to keep things clean 👍 This issue has been resolved

@lkysow
Copy link
Member

lkysow commented Feb 16, 2019

Thanks Phillip. Sorry for the trouble, Bitbucket Server is hard to test because I only have a trial license that expires 30 days after I create it.

@lkysow lkysow added bug Something isn't working and removed waiting-on-response Waiting for a response from the user labels Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working provider/bitbucket
Projects
None yet
Development

No branches or pull requests

3 participants