azure-pipelines-tasks: [REGRESSION]: FileTransform@2 task now returns `SucceededWithIssues` if there is nothing to transform

New issue checklist

Task name

FileTransform@2

Breaking task version

2.249.1

Last working task version

2.246.1

Regression Description

In the previous version, if there was nothing to transform in the file, an error message would appear but the task would return Succeeded Image

Now if there is nothing to transform in the file, the error message appears but the task now returns SucceededWithIssues Image

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

ubuntu-22.04

Relevant log output

<details>
  <summary>UNSUCCESSFUL RUN</summary>
  <pre> 2025-02-05T00:08:17.2161292Z ##[section]Starting: File transformation: appsettings.json
2025-02-05T00:08:17.2195145Z ==============================================================================
2025-02-05T00:08:17.2196642Z Task         : File transform
2025-02-05T00:08:17.2197981Z Description  : Replace tokens with variable values in XML or JSON configuration files
2025-02-05T00:08:17.2199358Z Version      : 2.249.1
2025-02-05T00:08:17.2203107Z Author       : Microsoft Corporation
2025-02-05T00:08:17.2204433Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/file-transform
2025-02-05T00:08:17.2205729Z ==============================================================================
2025-02-05T00:08:19.3347067Z Applying JSON variable substitution for **/appsettings.json
2025-02-05T00:08:20.3314853Z Applying JSON variable substitution for /__w/1/s/removedi/appsettings.json
2025-02-05T00:08:20.3360350Z ##[error]Error: Failed to apply JSON variable substitution. Changes are already present in the package.
2025-02-05T00:08:20.3392675Z ##[section]Finishing: File transformation: appsettings.json ] </pre>
</details>

<details>
  <summary>SUCCESSFUL RUN</summary>
  <pre>2025-02-02T07:04:20.6114722Z ##[section]Starting: File transformation: appsettings.json
2025-02-02T07:04:20.6141914Z ==============================================================================
2025-02-02T07:04:20.6143251Z Task         : File transform
2025-02-02T07:04:20.6144135Z Description  : Replace tokens with variable values in XML or JSON configuration files
2025-02-02T07:04:20.6145163Z Version      : 2.246.1
2025-02-02T07:04:20.6146091Z Author       : Microsoft Corporation
2025-02-02T07:04:20.6147005Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/file-transform
2025-02-02T07:04:20.6148049Z ==============================================================================
2025-02-02T07:04:22.3341889Z Applying JSON variable substitution for **/appsettings.json
2025-02-02T07:04:23.1457122Z Applying JSON variable substitution for /__w/1/s/removed/appsettings.json
2025-02-02T07:04:23.1489941Z ##[error]Failed to apply JSON variable substitution. Changes are already present in the package.
2025-02-02T07:04:23.1511458Z ##[section]Finishing: File transformation: appsettings.json</pre>
</details>

Full task logs with system.debug enabled

Repro steps


About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 25 (9 by maintainers)

Most upvoted comments

This is breaking logic in our pipelines. The error was annoying before, but now its a showstopper.

It depends whether you have continueOnError on true, but the main issue is that the task returns an error now where it didn’t used to do that. This is either unintended or should have been a major version increase (because it’s a breaking change in behavior).

For me the taks (and build) fails entirely if there is nothing to transform. Version 2.249.1.

Image

Behavior before (version 2.246.1)

Image

@EshitaD The checkbox or input means you set it to return ‘Failed’ if no substitution is done, but you cannot have it return as ‘Succeeded’ if that happens, only ‘SucceededWithIssues’.

That is a breaking change in behaviour. This sort of thing causes releases to be stopped because when they see a yellow exclamation mark they rightly pause to consider the consequences.

It’s fine to break how a task works but at least make that a V3 so that people have time to review the change and make pipeline changes accordingly.

Always good to mention - for me, the pipeline completes successfully, but its giving devs a panic attack seeing variable substitution errors being reported in a deployment pipeline.

Image

Hi All, we have fixed the issue by overriding the task version to 2.246.1 and are currently working on code changes.