Is there an IConfiguration
provider for Azure Devops pipeline variables?
I googled this for about 15 minutes but could not find anything.
We have a series of net5.0
projects with corresponding unit and integrations tests that rely in pipeline variables as follows:
- Tests use an
IConfigurationBuilder
, including environment variables - Variables are added to an Azure Devops Pipeline
- Modify the pipeline
yaml
to map the pipeline variables to environment variables
This is fairly straight forward. For each configuration setting that needs to be driven by a pipeline variable, we:
- Create the pipeline variable
- Modify the pipeline
yaml
to map the variable to an environment variable- on rare occasions, transform the value via powershell
I'd prefer to do something like:
var config = new ConfigurationBuilder()
.AddEnvironmentVariables(...)
.AddPipelineVariables(...) // considering writing this; don't what to reinvent the wheel
and skip the modifications to the pipeline yaml
.