Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Error when executing AdditionalArguments for AzureRmWebAppDeployment V4.227.0 #18841

Closed
1 of 4 tasks
mathieu-decroocq opened this issue Aug 17, 2023 · 6 comments
Closed
1 of 4 tasks
Labels
Area: Release bug regression This used to work, but a change in the service/tasks broke it. stale triage

Comments

@mathieu-decroocq
Copy link

Task name

AzureRmWebAppDeploymentV4

Task version

227.0

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

Windows

Task log

Starting: Deploy WebApp
==============================================================================
Task         : Azure App Service deploy
Description  : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
Version      : 4.227.0
Author       : Microsoft Corporation
Help         : https://aka.ms/azureappservicetroubleshooting
==============================================================================
Got service connection details for Azure App Service:'XX-WebApp-4'
Trying to update App Service Application settings. Data: null
App Service Application settings are already present.
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='C:\agent\_work\77\AppsArtifacts\WebApps\WebApp\WebApp.zip' -dest:auto,ComputerName='xxx',UserName='xxx',Password='***',AuthType='Basic' -setParam:name='IIS Web Application Name',value='WebApp-Name' -skip:objectName=filePath,absolutePath=^.*\.config$ -skip:objectName=filePath,absolutePath=favicon.ico -skip:objectName=filePath,absolutePath=appsettings.json -skip:objectName=dirPath,absolutePath=^.*Resources(?!CL|Generic|\\|$).*$ -enableRule:DoNotDeleteRule -userAgent:VSTS_dfbe8c30-6ad4-45b7-93f6-497ce161b00b_build_95_0

##[error]Error: 'Generic' is not recognized as an internal or external command,
operable program or batch file.

Relevant log output

Error: 'Generic' is not recognized as an internal or external command, operable program or batch file.

Aditional info

Since upgrading from version 4.225.1 to 4.227.0, we've had an error with the AdditionalArguments parameter.
It seems that double quotes are not considered. 
Here's the linked yml excerpt:
AdditionalArguments: '-skip:objectName=filePath,absolutePath="^.*\.config$" -skip:objectName=filePath,absolutePath="favicon.ico" -skip:objectName=filePath,absolutePath="appsettings.json" -skip:objectName=dirPath,absolutePath="${{ parameters.skipFolder }}"'

And the result in Azure Devops: 
-skip:objectName=filePath,absolutePath=^.*\.config$ -skip:objectName=filePath,absolutePath=favicon.ico -skip:objectName=filePath,absolutePath=appsettings.json -skip:objectName=dirPath,absolutePath=^.*Resources(?!CL|Generic|\|$).*$
@DmitriiBobreshev
Copy link
Contributor

DmitriiBobreshev commented Aug 18, 2023

Hi @mathieu-decroocq, seems like the problem started happening after changing the task handler to Node16, we started to use shell: true options because the bug in the node ecosystem when the path contains spaces(e.g. C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe) so you probably need to escape double quotes according to the logic to pass absolutePath's parameter as a string absolutePath="${{ parameters.skipFolder }}". After that, everything should work fine.

You can add double quotes using the pattern: "\" at the start and \"" at the end.
full example will be -skip:objectName=dirPath,absolutePath="\"${{ parameters.skipFolder }}\"".
After that passed parameter will be -skip:objectName=dirPath,absolutePath="${{ parameters.skipFolder }}" and should work fine
Could you please check that workaround fix the error?

Sorry for the inconvenience, we'll try to add automatic escaping for such cases in the next versions.

@alexangas
Copy link

@DmitriiBobreshev Unfortunately this is a breaking behaviour change across all of our web app deployment pipelines. It's not a simple fix for us to make the suggested alteration, or to revert to an older version of the task.

Is there any way the automatic escaping can be put in place ASAP please?

@mathieu-decroocq
Copy link
Author

Hi,
Thank you for your answers.
I tried to use the escape characters without success.
I've simplified my command and my folder skip regex in order to have a workaround but I'm not satisfied with the result.

AdditionalArguments: -skip:File='^.*\.config$' -skip:File='favicon.ico' -skip:File='appsettings.json' -skip:Directory='^.*Resources.*$'

@merlynomsft merlynomsft added the regression This used to work, but a change in the service/tasks broke it. label Aug 30, 2023
@merlynomsft
Copy link
Contributor

We are sorry for the delay in resolving this issue. To mitigate it, we rolled back to an earlier version, 4.225.1, which is not affected by the issue above. If you have any questions or concerns, please let us know.

@alexangas
Copy link

@merlynomsft Appreciate the rollback, thank you.

Both this issue and #14365 affected us and broke a number of our pipelines unexpectedly, which obviously has been a very poor customer experience as they are critical to our ability to deploy.

We're a little confused as to the testing process that has or hasn't taken place here. We are also unsure as to why such a significant move such as migrating to Node 16 that contains behavioural changes was not done as part of a major task version, which probably would have avoided any of these types of problems at all.

Copy link

github-actions bot commented Mar 2, 2024

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Mar 2, 2024
@github-actions github-actions bot closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Release bug regression This used to work, but a change in the service/tasks broke it. stale triage
Projects
None yet
Development

No branches or pull requests

4 participants