Set custom test variables in build job (#4020)

This commit is contained in:
Matt Thalman 2022-08-22 12:43:48 -05:00 коммит произвёл GitHub
Родитель 29b7921e83
Коммит 427097824d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 31 добавлений и 34 удалений

Просмотреть файл

@ -43,44 +43,12 @@ stages:
}
echo "##vso[task.setvariable variable=imageBuilderBuildArgs]$imageBuilderBuildArgs"
displayName: Set Custom Build Variables
- powershell: |
# Forward team project name for consumption by test script
$testRunnerOptions="-e SYSTEM_TEAMPROJECT='$env:SYSTEM_TEAMPROJECT'"
echo "##vso[task.setvariable variable=testRunner.options]$testRunnerOptions"
displayName: Set Custom Test Variables
- template: ../../../pipelines/steps/set-custom-test-variables.yml
- template: ../../../pipelines/steps/set-base-image-override-options.yml
parameters:
variableName: imageBuilderBuildArgs
customTestInitSteps:
- powershell: |
# Forward team project name for consumption by test script
$testRunnerOptions="-e SYSTEM_TEAMPROJECT='$env:SYSTEM_TEAMPROJECT'"
$testInit=""
if ("$(publishRepoPrefix)".Contains("/internal/")) {
if ("$env:ENABLEINTERNAL3_1" -eq "true") {
$sasQueryString = "$(dotnetclimsrc-read-sas-token)"
}
else {
$sasQueryString = "$(dotnetbuilds-internal-container-read-token)"
}
if ($Env:AGENT_OS -eq 'Linux') {
$testRunnerOptions="$testRunnerOptions -e SAS_QUERY_STRING='$sasQueryString' -e NUGET_FEED_PASSWORD='$(dn-bot-dnceng-artifact-feeds-rw)'"
}
if ($Env:AGENT_OS -eq 'Windows_NT') {
# Be sure to use a verbatim string when referencing the environment variables. We don't want the
# variables to be resolved in this script. We're generating the script here to be executed by the
# test step.
$testInit='$Env:SAS_QUERY_STRING=' + "'$sasQueryString'" + '; $Env:NUGET_FEED_PASSWORD=''$(dn-bot-dnceng-artifact-feeds-rw)'''
}
}
echo "##vso[task.setvariable variable=testRunner.options]$testRunnerOptions"
echo "##vso[task.setvariable variable=test.init]$testInit"
displayName: Set Custom Test Variables
- template: ../../../pipelines/steps/set-custom-test-variables.yml
customPublishInitSteps:
- template: ../../../pipelines/steps/set-public-source-branch-var.yml
- template: ../../../pipelines/steps/set-publish-mcrdocs-args-var.yml

Просмотреть файл

@ -0,0 +1,29 @@
steps:
- powershell: |
# Forward team project name for consumption by test script
$testRunnerOptions="-e SYSTEM_TEAMPROJECT='$env:SYSTEM_TEAMPROJECT'"
$testInit=""
if ("$(publishRepoPrefix)".Contains("/internal/")) {
if ("$env:ENABLEINTERNAL3_1" -eq "true") {
$sasQueryString = "$(dotnetclimsrc-read-sas-token)"
}
else {
$sasQueryString = "$(dotnetbuilds-internal-container-read-token)"
}
if ($Env:AGENT_OS -eq 'Linux') {
$testRunnerOptions="$testRunnerOptions -e SAS_QUERY_STRING='$sasQueryString' -e NUGET_FEED_PASSWORD='$(dn-bot-dnceng-artifact-feeds-rw)'"
}
if ($Env:AGENT_OS -eq 'Windows_NT') {
# Be sure to use a verbatim string when referencing the environment variables. We don't want the
# variables to be resolved in this script. We're generating the script here to be executed by the
# test step.
$testInit='$Env:SAS_QUERY_STRING=' + "'$sasQueryString'" + '; $Env:NUGET_FEED_PASSWORD=''$(dn-bot-dnceng-artifact-feeds-rw)'''
}
}
echo "##vso[task.setvariable variable=testRunner.options]$testRunnerOptions"
echo "##vso[task.setvariable variable=test.init]$testInit"
displayName: Set Custom Test Variables