-
Notifications
You must be signed in to change notification settings - Fork 284
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
Automatically include code reviewers in a git repo #29
Comments
Migrated from #364 (comment)
@xuzhang3 @nmiodice just one more question, I have another WIP pull request #306 which is currently blocked due to AZDO GO SDK. Should I create (copy of)an issue in the new repo? |
Migrated from #364 (comment) Hi @C123R Sorry for reply late. Thanks for you participate. We have migrated this repository to terraform-provioder. I will transfer the issues to the new repository. But you can start your work. New Repository Address |
Migrated from #364 (comment) Hi @C123R I will transfer the whole issues to new repo later. You can create a new issue in the new repo too, I will handle the duplicate issues. |
Migrated from #364 (comment) Hey @xuzhang3 👋, can I give a shot? |
Hi @C123R Can you comment on this issue so I can assign you this issue? :D |
ping |
@nmiodice Since you have worked on other branch policy resources. I would suggest renaming resource "azuredevops_branch_policy_code_reviewers" "codereviewer" {
project_id = azuredevops_project.project.id
settings {
reviewer_count = 1 #required
submitter_can_vote = true
auto_reviewer_ids = [
"XXXXXXXX-5243-65e6-8139-XXXXXXXXXX",
"XXXXXXXX-5243-65e6-8139-XXXXXXXXXX",
]
scope {
repository_id = azuredevops_git_repository.repository.id
repository_ref = azuredevops_git_repository.repository.default_branch
match_type = "Exact"
}
}
} Considering this as a breaking change, sure we can deprecate existing resources and add another one as suggested. What do you think? |
@C123R I think that's good idea! I'd go for the name |
@EliiseS Sorry, I was wrong. I think we need to stick with the different resources for Reason: Even though both the policies are using the same endpoint and policy configuration, they have different policy type reference. For instance, the below request would be rejected with error {
"isEnabled": true,
"isBlocking": false,
"type": {
"id": "fa4e907d-c16b-4a4c-9dfa-4906e5d171dd" # typeRef for minimum reviewers
},
"settings": {
"minimumApproverCount": 1,
"creatorVoteCounts": false,
"requiredReviewerIds": [ # autoreviwers id
"1d1dad71-f27c-4370-810d-838ec41efd41"
],
"scope": [
{
"repositoryId": null,
"refName": "refs/heads/master",
"matchKind": "exact"
}
]
}
} I will continue with the |
@C123R I'm not 100% I understand, but I think you mean to say their request objects are different, right? I think it would still be worth it to add them under one, similar to how I'm doing here: https://github.com/terraform-providers/terraform-provider-azuredevops/pull/17 |
Ahh sorry. So, yeah your guess was right. The request objects are different, every branch policy has a unique policy type ref and respective settings. @nmiodice have nicely explained it here.
I had a quick look at your PR, I think you are conditionally changing the request body, right?. But that's not something we need it here. Let me try to explain with an example: Considering resource "azuredevops_branch_policy_reviewers" "codereviewer" {
project_id = azuredevops_project.project.id
settings {
reviewer_count = 2 # min_reviewer count
submitter_can_vote = true
auto_reviewer_ids = [ # required_reviewers
"XXXXXXXX-5243-65e6-8139-XXXXXXXXXX",
"XXXXXXXX-5243-65e6-8139-XXXXXXXXXX",
]
scope {
repository_id = azuredevops_git_repository.repository.id
repository_ref = azuredevops_git_repository.repository.default_branch
match_type = "Exact"
}
}
} Here, in this case, we need to make 2
{
"type": {
"id": "fa4e907d-c16b-4a4c-9dfa-4906e5d171dd" # typeRef for minimum reviewers
},
"settings": {
"minimumApproverCount": 2,
"scope": [..]
}
}
{
"type": {
"id": "fd2167ab-b0be-447a-8ec8-39368250530e" # typeRef for requiredReviewer
},
"settings": {
"requiredReviewerIds": [
"1d1dad71-f27c-4370-810d-838ec41efd41"
],
"scope": [..]
}
} Sure. The creation of multiple policies is not that complicated, but my confusion or why I see its complicated(maybe due to lack of experience in terraform providers): How are we gonna deal with the ID of such a resource? as per my understanding, (also in current implementation |
@C123R Ah, I see now! You're correct, in that case I think it's best to split them like you intend to :) Looking forward to the PR! |
Close this issue for #71 |
Migrated from #364
Originally created by @ferrandinand on Fri, 05 Jun 2020 10:43:24 GMT
Community Note
Description
We would like to add the possibility to configure code reviewers for a repository created in Azure Devops as it is explained in the official documentation (references bellow)
New or Affected Resource(s)
Potential Terraform Configuration
References
https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops#automatically-include-code-reviewers
https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/repos/policy/required-reviewer?view=azure-cli-latest
The text was updated successfully, but these errors were encountered: