Closed Zhaph closed 3 years ago
This is as per design https://github.com/microsoft/azure-pipelines-tasks/issues/12277
I would respectfully suggest then that the design is wrong.
There are no meaningful errors in the tasks, and they are successfully applying the transforms and replacements, but the tasks are erroneously reporting an error back to the pipeline and showing as errors on the report when in fact everything is behaving as expected.
How is this "by design"?
There are some other requirements which made us to add this change. https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/FileTransformV2
The new File Transform Task version fails when no substitution has been applied (i.e. the changes were already present in the package).
If you don't want to fail task, you can check "Continue On Error" checkbox.
For anyone landing here who wants to squelch this error when doing JSON-only transforms:
xmlTransformationRules: ''
For anyone landing here who wants to squelch this error when doing JSON-only transforms:
xmlTransformationRules: ''
Just to follow up with an example:
- task: FileTransform@2
inputs:
folderPath: 'myFolder'
jsonTargetFiles: 'appsettings.json'
xmlTransformationRules: ''
I can confirm that @shemsiu solution works. The error is not displayed when using xmlTransformationRules: ''
If you don't want to fail task, you can check "Continue On Error" checkbox.
This is a terrible suggestion. I do want the pipeline to stop on errors.
That should not be an error in the first place. I would suggest fixing the root cause instead of suggesting us brittle workarounds.
I ran into this issue while using Classic Pipelines. It seems to me that this happens when there are no variable substitutions to be made.
I was in the process of creating a new stage and all existing variables were scoped specifically to other (existing) stages. As soon as I added a valid variable to the new stage's scope the problem went away.
It does seems useful to be notified when no transformations take place, as it highlights that some configuration might be missing. But for this to cause the task to trigger an error seems overkill and counterproductive. A warning seems like it would be more helpful.
I would respectfully suggest then that the design is wrong.
There are no meaningful errors in the tasks, and they are successfully applying the transforms and replacements, but the tasks are erroneously reporting an error back to the pipeline and showing as errors on the report when in fact everything is behaving as expected.
How is this "by design"?
I feel like the error is misleading as well. It implies that transformations are happening twice, rather than transformations not happening. I spent wayyyyyyyyyyyyyyy too much time trying to find out why I was getting this error until I discovered this thread. Why in the world would I suspect XmlTransformationRule: ""
would be the solve based on the error given.
This either needs to be set as an "Info" block, or the messaging needs to be updated to be more specific on what the issue really is.
Required Information
Question, Bug, or Feature?
Type: bug
Enter Task Name: FileTransform
Environment
Server - Azure Pipelines or TFS on-premises?
Agent - Hosted or Private:
Issue Description
I have a multi-stage YAML pipeline, that has the following Filesystem Transform task defined in a Deployment Job:
We have two configuration files in the root of the application that need at least the Release transform applied (web.config and ApplicationInsights.config) as well as optional environment transforms. Similarly there are a number of .config files in the config folder, that have optional release and environment transforms.
Looking at the logs and the transformed files, all transforms are being correctly applied to the target files, but we are still getting the following error reported from the task (note that this is not stopping the deployment, but it is creating noise in the reports that makes it look like an error has occurred):
Task logs
23.txt
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
Error logs