terraform-provider-azuredevops icon indicating copy to clipboard operation
terraform-provider-azuredevops copied to clipboard

Agent Pool - Azure virtual machine scale set

Open aleqsss opened this issue 3 years ago • 45 comments

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

The 'Azure virtual machine scale set' pool type of agent pools, inside of Azure DevOps, has now been released and is publicly available, since the (what I can see) version 6.0 of the Azure DevOps REST API. This makes me think that it would be suitable to be able to configure such, from this provider.

As you can see in the documentation, it now implementes the TaskAgentPoolOptions definition which allows you to specify, amongst others, the elasticPool property.

New or Affected Resource(s)

Affected Resources:

  • azuredevops_agent_pool

Affected Data Sources:

  • azuredevops_agent_pool
  • azuredevops_agent_pools

References

From what I can see, this provider is using the azure-devops-go-api which, at the time of writing, doesn't implement the elasticPool / TaskAgentPoolOptions. Because of this I've created the following issue in that repository:

aleqsss avatar Oct 15 '20 12:10 aleqsss

I'm interested in working/contributing on this issue, but I'm impeded because as of my understanding, the azure-devops-go-api is using an internal tool/code generator to generate the SDK.

aleqsss avatar Oct 15 '20 12:10 aleqsss

@xuzhang3 would it be possible for you to ask internally at Microsoft what the plans are for the updated SDK?

@aleqsss has been waiting for a reply for quite some time and would be great to understand what the plans are.

I created the following more than a week ago and still nothing: https://github.com/microsoft/azure-devops-go-api/issues/93

Thank you 😊

simongottschlag avatar Nov 30 '20 23:11 simongottschlag

@simongottschlag Sure, I will update the information when I got response from service team.

xuzhang3 avatar Dec 02 '20 03:12 xuzhang3

Thank you for your input, @simongottschlag and @xuzhang3.

Unfortunately I haven't received any feedback whatsoever, on the Add new taskagent resource functionality #90 issue/feature request. So an information update in regards of the plans of updating that SDK, would be highly appreciated @xuzhang3. Thank you for investigating this internally.

aleqsss avatar Dec 02 '20 08:12 aleqsss

@xuzhang3 were you able to get any response from the service team?

Thank you! 🙂

aleqsss avatar Feb 01 '21 13:02 aleqsss

Hi @aleqsss We have some internal progress, I will update it here if there is any update.

xuzhang3 avatar Feb 02 '21 03:02 xuzhang3

Thank you @xuzhang3, I appreciate that!

aleqsss avatar Feb 02 '21 12:02 aleqsss

@xuzhang3 Any update on the internal progress you mentioned?

stefanes avatar Apr 16 '21 14:04 stefanes

@stefanes I get some repsonse internal that v6.x will be released but do not have the timeline

xuzhang3 avatar Apr 16 '21 17:04 xuzhang3

@xuzhang3, any updates in regards of the timeline? 🙂

aleqsss avatar May 07 '21 09:05 aleqsss

Thank you for your input, @simongottschlag and @xuzhang3.

Unfortunately I haven't received any feedback whatsoever, on the Add new taskagent resource functionality #90 issue/feature request. So an information update in regards of the plans of updating that SDK, would be highly appreciated @xuzhang3. Thank you for investigating this internally.

Wouldn't they be using AutoREST like the Azure SDK?

daniel-anova avatar Jun 22 '21 08:06 daniel-anova

Any update on the v6.x release?

mvanderlyn27 avatar Jul 08 '21 03:07 mvanderlyn27

No good news, the SDK repo is in low activity. A workaround I thinking is embed the new features as a patch in this repo and handle the sdk ourselves. DevOps swagger: https://github.com/MicrosoftDocs/vsts-rest-api-specs

xuzhang3 avatar Jul 13 '21 06:07 xuzhang3

Is this coming up anytime soon ? Needed this like yesterday.

ramsateesh avatar Jul 14 '21 00:07 ramsateesh

Thank you for your input, @simongottschlag and @xuzhang3. Unfortunately I haven't received any feedback whatsoever, on the Add new taskagent resource functionality #90 issue/feature request. So an information update in regards of the plans of updating that SDK, would be highly appreciated @xuzhang3. Thank you for investigating this internally.

Wouldn't they be using AutoREST like the Azure SDK?

If you look at the filed issue https://github.com/microsoft/azure-devops-go-api/issues/90 (mentioned in this issue description) you can see that it seems like they are using some internal tool for generating this. 🙂

aleqsss avatar Jul 21 '21 08:07 aleqsss

@xuzhang3 take a look at this issue (#93) (more specifically this and this post) in the azure-devops-go-api.

It seems like they've started the work with updating the SDK to 6.0 and 6.1. 🎉 So hopefully it won't be necessary with a workaround where we need to handle the SDK ourselves.

When this is done, it also enables the possibility to add functionality for the other missing parts of version 6.0 and 6.1, to this Azure DevOps Terraform provider, which to be honest would be most welcome. 🙂

No good news, the SDK repo is in low activity. A workaround I thinking is embed the new features as a patch in this repo and handle the sdk ourselves. DevOps swagger: https://github.com/MicrosoftDocs/vsts-rest-api-specs

aleqsss avatar Aug 25 '21 13:08 aleqsss

Hi @aleqsss thanks for ping me out here. we have noticed this issue, after v6 and v6.1 SDK released, I will update the go.mod and vendor files.

xuzhang3 avatar Aug 26 '21 03:08 xuzhang3

@nechvatalp Just to make you aware that @xuzhang3 was planning on updating here too so I'm hoping it's in your remit. Thank you !

gabrielmccoll-rlg avatar Nov 05 '21 23:11 gabrielmccoll-rlg

VMSS_agent.zip

Just in case this is useful to anyone else, the work around I managed to get was using the rest api and powershell and some null resources. the attached zip has two scripts, one for remove and one for adding the agent pool , along with a tf showing example of how used.

gabrielmccoll avatar Nov 06 '21 20:11 gabrielmccoll

also I think it needs 6.1 for this as Elastic Pools create doesn't seem to exist in 6.0 ?https://docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/elasticpools/create?view=azure-devops-rest-6.1&viewFallbackFrom=azure-devops-rest-6.0

gabrielmccoll-rlg avatar Nov 08 '21 09:11 gabrielmccoll-rlg

@gabrielmccoll-rlg seems the elastic pool APIs only available in preview APIs

xuzhang3 avatar Nov 09 '21 03:11 xuzhang3

@gabrielmccoll-rlg seems the elastic pool APIs only available in preview APIs

Yeah that's a shame. I notice it does mention elastic pools on the create pool api for 6.0 as a pooltype I think it was but no indication of how to use it.

gabrielmccoll avatar Nov 09 '21 08:11 gabrielmccoll

@xuzhang3 @nechvatalp pushed the v6.0 API into azure-devops-go-api https://github.com/microsoft/azure-devops-go-api/pull/110 The v6.0 API contains the API definition and corresponding models for the Elastic Pool Agents which utilizes Azure Virtual Machine Scale Sets. What are the major steps to migrate the DevOps provider to use the v6.0 API? After that someone could implement resources and data sources to support Elastic Pool Agents.

tmeckel avatar Nov 29 '21 17:11 tmeckel

@xuzhang3 @nechvatalp pushed the v6.0 API into azure-devops-go-api https://github.com/microsoft/azure-devops-go-api/pull/110 The v6.0 API contains the API definition and corresponding models for the Elastic Pool Agents which utilizes Azure Virtual Machine Scale Sets. What are the major steps to migrate the DevOps provider to use the v6.0 API? After that someone could implement resources and data sources to support Elastic Pool Agents.

Sounds good. Am not sure you you do that with the v6 api. It was simple with the v6.1 so if there's an example of doing it with 6 that be great

gabrielmccoll avatar Nov 29 '21 18:11 gabrielmccoll

I tried a quick upgrade of the provider to the v6 API. I expected some issue but surprisingly the new v6 API lacks some models, which, for my understanding, should not be the case .

Example: image

@nechvatalp is there something wrong with the generation process?

I checked the OpenAPI specification v6 for Git and the GitChange model is defined in the JSON File

https://github.com/MicrosoftDocs/vsts-rest-api-specs/blob/8284433147b306c76d642da782c58b6cdea8f5ad/specification/git/6.0/git.json#L11069

@xuzhang3

tmeckel avatar Dec 01 '21 12:12 tmeckel

@tmeckel yes, seems like problem with the generation.

I will look at it and try to fix it.

nechvatalp avatar Dec 01 '21 13:12 nechvatalp

@tmeckel @nechvatalp thanks very much for keeping us updated on this and the other thread too

gabrielmccoll avatar Dec 02 '21 10:12 gabrielmccoll

@tmeckel I updated the generation tool and regenerated the clients, lot more models are present now. Hopefully, nothing is missing this time. Thanks for spotting the issue.

nechvatalp avatar Dec 02 '21 19:12 nechvatalp

@nechvatalp great news 🤙🏼 I'll give it a try tomorrow!

tmeckel avatar Dec 02 '21 19:12 tmeckel

@nechvatalp these are the issues that are left after you re-created the v6 API

# github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/memberentitlementmanagement
azuredevops/internal/service/memberentitlementmanagement/resource_user_entitlement.go:330:60: clients.MemberEntitleManagementClient.GetUserEntitlements undefined (type memberentitlementmanagement.Client has no field or method GetUserEntitlements)
azuredevops/internal/service/memberentitlementmanagement/resource_user_entitlement.go:330:94: undefined: memberentitlementmanagement.GetUserEntitlementsArgs
# github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint
azuredevops/internal/service/serviceendpoint/commons.go:255:4: unknown field 'Project' in struct literal of type serviceendpoint.CreateServiceEndpointArgs
azuredevops/internal/service/serviceendpoint/commons.go:293:4: unknown field 'Project' in struct literal of type serviceendpoint.UpdateServiceEndpointArgs
azuredevops/internal/service/serviceendpoint/commons.go:304:4: unknown field 'Project' in struct literal of type serviceendpoint.DeleteServiceEndpointArgs
# github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/taskagent
azuredevops/internal/service/taskagent/resource_variable_group.go:303:4: unknown field 'Group' in struct literal of type taskagent.AddVariableGroupArgs
azuredevops/internal/service/taskagent/resource_variable_group.go:304:4: unknown field 'Project' in struct literal of type taskagent.AddVariableGroupArgs
azuredevops/internal/service/taskagent/resource_variable_group.go:314:4: unknown field 'Project' in struct literal of type taskagent.UpdateVariableGroupArgs
azuredevops/internal/service/taskagent/resource_variable_group.go:316:4: unknown field 'Group' in struct literal of type taskagent.UpdateVariableGroupArgs
azuredevops/internal/service/taskagent/resource_variable_group.go:327:4: unknown field 'Project' in struct literal of type taskagent.DeleteVariableGroupArgs

Looks great for the second attempt to do a major API upgrade :-)

I'm not sure if those issues are a result of the API has been changed or the generation process has still a bug. Do you have any information on this?

@xuzhang3 I'll file a draft PR for tracking the upgrade to the v6 API :-)

tmeckel avatar Dec 03 '21 14:12 tmeckel