Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions eng/common/TestResources/SubConfig-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,17 @@ function SetSubscriptionConfiguration([object]$subscriptionConfiguration)
# Mark values as secret so we don't print json blobs containing secrets in the logs.
# Prepend underscore to the variable name, so we can still access the variable names via environment
# variables if they get set subsequently.
if ([Environment]::GetEnvironmentVariable($nestedPair.Name)) {
throw "Environment variable '$($nestedPair.Name)' is already set. Check the tests.yml/ci.yml EnvVars parameter does not conflict with the subscription config json"
}
if (ShouldMarkValueAsSecret "AZURE_" $nestedPair.Name $nestedPair.Value) {
Write-Host "##vso[task.setvariable variable=_$($nestedPair.Name);issecret=true;]$($nestedPair.Value)"
}
}
} else {
if ([Environment]::GetEnvironmentVariable($pair.Name)) {
throw "Environment variable '$($pair.Name)' is already set. Check the tests.yml/ci.yml EnvVars parameter does not conflict with the subscription config json"
}
if (ShouldMarkValueAsSecret "AZURE_" $pair.Name $pair.Value) {
Write-Host "##vso[task.setvariable variable=_$($pair.Name);issecret=true;]$($pair.Value)"
}
Expand Down
8 changes: 8 additions & 0 deletions eng/common/TestResources/build-test-resource-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ parameters:
- name: SubscriptionConfigurations
type: object
default: null
# EnvVars is used to help diagnose variable conflict issues early
- name: EnvVars
type: object
default: null

steps:
- ${{ if parameters.SubscriptionConfiguration }}:
Expand All @@ -16,6 +20,8 @@ steps:
. ./eng/common/TestResources/SubConfig-Helpers.ps1
SetSubscriptionConfiguration $config
displayName: Initialize SubscriptionConfiguration variable
${{ if parameters.EnvVars }}:
env: ${{ parameters.EnvVars }}

- ${{ if parameters.SubscriptionConfigurations }}:
- pwsh: |
Expand All @@ -36,3 +42,5 @@ steps:
UpdateSubscriptionConfiguration $configBase $config

displayName: Merge Test Resource Configurations
${{ if parameters.EnvVars }}:
env: ${{ parameters.EnvVars }}