question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure App Service Deploy overwrites content of wwwroot with old version of application

See original GitHub issue

Question, 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
czerwinskilukasz1commented, Dec 20, 2020

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

0reactions
sunkarakamalcommented, Jun 14, 2022

y alias is tijohnso.

Hi I also have same issue. Did you get any solution for the same

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Slot Deploy to Virtual Directory Overwrites/Clears the ...
I am facing an issue with Azure Deployment slots. Previously I had a .NET Core 2.2 AppService in Azure and had a virtual...
Read more >
How to make files not get overwritten during app service ...
Solution to prevent icon overwriting: theres actually 2 ways: we could pass -enableRule:DoNotDeleteRule in Azure App Service Deploy ...
Read more >
Azure App Service deploy v4 task - Microsoft Learn
Deploy to Azure App Service a web, mobile, or API app using Docker, ... This option overwrites all existing contents in the wwwroot...
Read more >
Continuous deployment to Azure App Service - Microsoft Learn
The Development Center (Classic) page in the Azure portal, an earlier version of the deployment functionality, was deprecated in March 2021.
Read more >
Configure apps - Azure App Service - Microsoft Learn
To add a new app setting, click New application setting. To edit a setting, click the Edit button on the right side. In...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found