I have an Azure DevOps pipeline
pool:
vmImage: 'windows-latest'
variables:
System.Debug: true
one: actual-value
Two: actual-value
MappedValue: actual-value
steps:
- task: FileTransform@2
displayName: V2 - Transform
env:
Three: actual-value
four: actual-value
five: $(MappedValue)
Six: $(MappedValue)
inputs:
folderPath: ./
jsonTargetFiles: settings.json
xmlTargetFiles: ''
xmlTransformationRules: ''
- pwsh: "Get-ChildItem Env:"
- publish: settings.json
artifact: settings.json
and the following settings.json file
{
"one":"default",
"two":"default",
"three":"default",
"four":"default",
"five":"default",
"six":"default"
}
Now I was hoping that the file transform task will be able to substitute all the value in the settings file but in reality only "one" is replaced.
Few thing to note:
- ONE and TWO are set as env variables as seen in the list
- Only ONE get replaced in settings.json but TWO does not
- Two is define as Pascal case but is lower case in settings file
- one and Two both appear in uppercase in env variables listed
- Three, four , five and six are mapped to task environment variables
- mapped variables also do not get transformed in the settings
So my question is what are the rules for transform task to be able to replace values in settings file? and why only one works and no other one works even they are mapped to env variables all with upper case?