dotnet / arcade-services

Arcade Engineering Services
MIT License
54 stars 72 forks source link

Unify AzDO token retrieval across Maestro and darc #3689

Closed premun closed 6 days ago

premun commented 1 week ago

In order to use the token credentials correctly and everywhere, we need to stop using hardcoded PATs and rather keep calling GetToken() every time we need to use it. The credentials can then either have a PAT inside (if we supply one in darc via args) or we will use AzureCLI or managed identities to obtain it. The system of choosing the credential has now been also unified with how we handle Maestro API tokens.

This code change unifies the approach so that the AzureDevOpsTokenProvider is used everywhere for that purpose. It also changes how we configure what kind of credential to use. Each AzDO account can still have it's own way.

Lastly, more classes become DI-friendly and easier to obtain/depend on (such as AzureDevOpsClient).

https://dev.azure.com/dnceng/internal/_workitems/edit/6419

premun commented 6 days ago

@oleksandr-didyk I am deploying this PR in here: https://dev.azure.com/dnceng/internal/_build/results?buildId=2484351&view=results to staging. Let's see how it goes