Azure App Service Deploy overwrites content of wwwroot with old version of application
See original GitHub issueQuestion, Bug, or Feature?
Type: Bug
Enter Task Name: Azure App Service deploy (v4.*)
Environment
Azure DevOps (hosted agent) Agent - Private Windows NT 2.170.1
Issue Description
Issue is very similar and started as this one https://github.com/microsoft/azure-pipelines-tasks/issues/11661
When I started developing pipeline for our project I needed to deploy 2 web apps on 1 app service in Azure. My starting options for 2 deployments were as follows:
- task: AzureRmWebAppDeployment@4
displayName: 'Deploy ${{ parameters.projectName}} '
inputs:
azureSubscription: ${{ parameters.azureSubscription }}
WebAppName: $(Deploy.App1.WebAppName)
packageForLinux: '$(Pipeline.Workspace)/backend/${{ parameters.projectName }}'
VirtualApplication: '/' # /app1 for app1
AppSettings: >-
-- redacted --
First i was deploying app to wwwroot and then I was publishing second app to different dir. I had noticed that my first app is being wiped out from the earth after second publish so I changed order of publishing and everything seemed ok up to Friday this week - so it was publishing in this order:
app1 - \app1
app2 - \
I had this super weird issue where my code was acting like code from few weeks ago. i had some initialization logic that I changed recently and the change were not visible on remote. It turned out that during deployment of app1
it was somehow deploying old content of my code to \
and it was long enough so all initialization logic for this app was running and it was giving me wrong results.
Chronology of events:
- app1 starts deployment
- during deployment of app1 I see that dll of app2 is being changed to one from 6th november
- app2 old dll is doing unwanted changes to db.
- app1 completes deployment
- app1 is being deployed with newest version
- app1 crashes due to changes made by old dlls of app1 that app2 created.
Task logs
I would rather not disclose logs atm.
Fix attemps
- I added UseWebDeploy: true to deploy files per this comment
- Nothing changed. I still got old app that is doing old stuff.
- I did simple recurse search on D:/home
- I did not find old version of my app. Searching on D:/ resulted on error.
- I found only new dll that is correct.
- I decompiled compiled code
- it was new code - that’s correct behaviour.
- I checked if app1 published directory contains app2
- there was no sight of app2 files in app1.
- I checked if I have any old files in checked source code
- 1:1 match with kdiff3
- I will list all files in publish directory for my job
- Everything looks normal. That dll is only in 1 place and it’s new one and it is in app2 directory.
- I tried to use
RemoveAdditionalFilesFlag
- Problem was not resolved.
- I changed task version to 3
- This resolved the problem. Old version of app2 is no longer running during deploy of app1.
- This is only workaround for me. It is not real solution.
Workaround
Change task version to 3. (There is 1 important change between 3<->4 - packageForLinux for version 3 is not alias for Package as it is in v4)
input json (it is not clear from readme what are inputs names): https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzureRmWebAppDeploymentV3/task.json readme: https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzureRmWebAppDeploymentV3/README.md
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:12 (5 by maintainers)
Hello @chshrikh and @arjgupta , it’s been a while since we submitted this issue. Are there any updates?
I wish you Happy Holidays soon. Best, Łukasz
Hi I also have same issue. Did you get any solution for the same