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

Fix to support project creation on Azure Devops "Server" #104

Open
altinoren opened this issue Jul 26, 2020 · 1 comment
Open

Fix to support project creation on Azure Devops "Server" #104

altinoren opened this issue Jul 26, 2020 · 1 comment

Comments

@altinoren
Copy link

altinoren commented Jul 26, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, 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

Description

Hi,
I'm investigating the possibility of using Azure DevOps provider on an on-premises installation of Azure DevOps Server for a client. Documentation does not mention supporting Server edition anywhere, but API's are almost identical I thought it might work. It doesn't, but the fix might be simple.

The configuration mentioned at the end gives the following error when applied against Azure DevOps Server 2019 and Server 2020 RC1:

Error: Error flattening project: Error parsing Work Item Template ID, got : invalid UUID length: 0

At this state, the project is already created but the provider fails when trying to retrieve data for process_template_id attribute. The error is caused by the differences between AzDO Services and AzDO Server when returning project capabilities (Url is _apis/projects/{guid}?api-version=5.1&includeCapabilities=true for both).

Server
    "capabilities": {
        "processTemplate": {
            "templateName": "Scrum"
        },
        "versioncontrol": {
            "sourceControlType": "Git",
            "gitEnabled": "True",
            "tfvcEnabled": "False"
        }
    }
Services
    "capabilities": {
        "processTemplate": {
            "templateName": "Scrum",
            "templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45"
        },
        "versioncontrol": {
            "sourceControlType": "Git",
            "gitEnabled": "True",
            "tfvcEnabled": "False"
        }
    },

templateTypeId is not returned by Azure DevOps Server for API versions 1.0 to 5.1 (and 6.0 in RC1). Hence, this line can't get it and faults in the subsequent use of it:
https://github.com/terraform-providers/terraform-provider-azuredevops/blob/24d9cf048fa6baacb4eb416c726b7db4678490d5/azuredevops/internal/service/core/resource_project.go#L390-L391

Line 391 is redundant since template name is already known through capabilities returned by the API call.
On Line 390, templateTypeId might be available (Services) or not (Server).

To fix the error when it's not available, there's already a method to call to get template id when template name is known:
https://github.com/terraform-providers/terraform-provider-azuredevops/blob/24d9cf048fa6baacb4eb416c726b7db4678490d5/azuredevops/internal/service/core/resource_project.go#L421

Is Azure DevOps Server is supported? If so, would you fix this? If not, would you accept a PR to fix this?

Thanks.

(Tests against Server edition performed on DevOps VM)

New or Affected Resource(s)

  • azuredevops_project

Potential Terraform Configuration

provider "azuredevops" {
  version = ">= 0.0.1"
  org_service_url  = "http://vsalm:8080/tfs/DefaultCollection"
  personal_access_token = "removed"
}

resource "azuredevops_project" "p" {
  project_name  = "First Project"
  description   = "First Project Description"
  version_control   = "Git"
  work_item_template    = "Scrum"
}

resource "azuredevops_git_repository" "p_repo" {
  project_id = azuredevops_project.p.id
  name       = "Framework"
  initialization {
    init_type = "Clean"
  }
}

References

none

@xuzhang3
Copy link
Collaborator

Hi @altinoren Currently, we have no plan to support Azure DevOps Server. You can submit PR to fix this as you have mentioned in this issues, templateTypeId has been returned in capabilities. But I cannot guarantee that other resource can work correct with Azure DevOps Server.

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

2 participants