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 issue with Azure DevOps (HTTP 400) #1152

Closed
Dilergore opened this issue Aug 11, 2020 · 5 comments
Closed

Automerge issue with Azure DevOps (HTTP 400) #1152

Dilergore opened this issue Aug 11, 2020 · 5 comments

Comments

@Dilergore
Copy link

Dilergore commented Aug 11, 2020

Hello,

I've set the auto merge setting and Atlantis tries to merge in (Complete) the pull request after applies it.

The issue is that I'm getting HTTP 400 when it tries to call the DevOps API.

Logs:
2020/08/11 14:02:23+0000 [INFO] apply_step_runner.go:56 maskedorgname/tech-cloud-core-services/cloud-pipeline_demo#2800: Apply successful, deleting planfile

2020/08/11 14:02:24+0000 [DBUG] command_runner.go:580 maskedorgname/tech-cloud-core-services/cloud-pipeline_demo#2800: Updating DB with pull results

2020/08/11 14:02:25+0000 [INFO] command_runner.go:386 maskedorgname/tech-cloud-core-services/cloud-pipeline_demo#2800: Automerging pull request

2020/08/11 14:02:25+0000 [EROR] command_runner.go:390 maskedorgname/tech-cloud-core-services/cloud-pipeline_demo#2800: Automerging failed: merging pull request: Request to https://dev.azure.com/maskedorgname/tech-cloud-core-services/_apis/git/repositories/cloud-pipeline_demo/pullrequests/2800?api-version=5.1-preview.1 responded with status 400

@Dilergore
Copy link
Author

Dilergore commented Sep 3, 2020

I can see that in the background we are calling the 5.1-preview.1 API version. I can also see in the official MS docs that there are newer (and non-preview) APIs now. Is there a reason why we are not calling stable API versions like 5.1 or 6.0? I am not saying this is what is causing the issue, just wondering, I would trust the behavior "more" with a non-preview one.

https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/update?view=azure-devops-rest-6.0

@Dilergore
Copy link
Author

Here is the error in details:

{
	"$id": "1",
	"innerException": null,
	"message": "Invalid argument value.\r\nParameter name: Invalid pull request auto complete set by id. Valid values are either the current user identity id, or an empty guid (to unset auto complete).",
	"typeName": "Microsoft.TeamFoundation.SourceControl.WebServer.InvalidArgumentValueException, Microsoft.TeamFoundation.SourceControl.WebServer",
	"typeKey": "InvalidArgumentValueException",
	"errorCode": 0,
	"eventId": 0
}

@Dilergore
Copy link
Author

Dilergore commented Sep 4, 2020

We will probably need an implementation for this API:
https://docs.microsoft.com/en-us/rest/api/azure/devops/ims/identities/read%20identities?view=azure-devops-rest-6.0

with a filter:
Identities?searchFilter=General&filterValue=username%40domain.com

Currently we are sending a static string "atlantis" as the id. The id should be the DevOps user Id who is performing the PR update/merge. The solution will likely need to look up the id for the user provided by the --azuredevops-user server parameter.

@Dilergore
Copy link
Author

We tried and it seems it is enough to add the user id of the user who opened the PR. It is not necessary to have there the id of the user who is doing the actual action.

@tapaszto
Copy link
Contributor

Hi @Dilergore,
It can be closed as #1289 fixed this issue

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

3 participants