I have a Tests step in my pipeline. I want that step to run all tests on scheduled runs but only impacted Tests on manual or gated runs.
To do this, I linked the runOnlyImpactedTests value to a process variable and I'm trying to modify its value using Powershell.
I'm able to read the variable but I can't change it. I have two questions but first, here are the PS scriptlet
Write-Host "a ${Env:Parameters_runOnlyImpactedTests} b"
Write-Host "##vso[task.setvariable variable=Parameters.runOnlyImpactedTests]True"
Write-Host "c ${Env:Parameters_runOnlyImpactedTests} d"
#Build Reasons:
#https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/ff736208(v=vs.120)
if($Env:BUILD_REASON -eq "Schedule"){
Write-Host "Is Scheduled. Should run all tests"
Write-Host "##vso[task.setvariable variable=Parameters.runOnlyImpactedTests]False"
}
#gci env:
#gci variable:
# Use the environment variables input below to pass secret variables to this script.
and its output
2019-11-04T18:32:37.5783531Z Génération du script.
2019-11-04T18:32:37.6377454Z a False b
2019-11-04T18:32:37.6408504Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\BuildsVnexAgents\Agt1-3348\_work\_temp\2fca26a4-3bb5-4d51-9d90-a29aa4c755b5.ps1'"
2019-11-04T18:32:37.9377454Z c False d
2019-11-04T18:32:37.9846229Z
I also tried setting the variable using Parameters_runOnlyImpactedTests and Env:Parameters_runOnlyImpactedTests but they all give the same result.
My two questions now:
- Why isn't the variable taking the value
- If it can't work that way, are there alternatives in achieving my goal?

