Azure Web Apps Serves Old Files
I am using an Azure DevOps release pipeline to deploy code to an Azure Web App. It pulls my .war file from my most recent build pipeline to deploy. However, it serves old code. For example, the app has referenced an old application.properties file, in the past. It also will reference previously deleted files at runtime, even when the code has no reference to those files.I have attempted to restart, stop and start the app, to no avail. It’s running on a Tomcat 9.0 server.
In my current position, I'm limited to using TFVC so resorted to using the DevOps pipeline UI, instead of yaml. For my release pipeline, I use the "Azure App Service deploy" task.
I have seen this previously posted https://stackoverflow.com/questions/51685496/azure-web-app-serving-old-files , but I am confident it is not a personal caching issue. First, I have cleared my browser's cache, and also have used a different browser, which hadn't cached the old site. Second, and more indicative of the issue, I can push code through the Eclipse Azure plugin, which then causes the web app to serve the most recent code. However, I don't get similar functionality from the DevOps release pipeline
I have snooped around on kudu and still can't find the issue. Similar to the previously linked question, I discover that the code appears to be the most recent. I have also manually deleted the code from webapps folder, then redeployed from the DevOps pipeline, with no luck. I'm trying to discover what the Azure Eclipse does differently in deployment that I'm missing in my DevOps pipeline. Is Tomcat caching content? If so, is there a way to automate a clear cache using Azure Pipelines' UI?
Alberto last edited by
I discovered two issues that hindered the pipeline deploying properly.
First, it appears that the Azure plugin for Eclipse creates an app.war file in the wwwroot folder of the app. Azure, apparently, prioritizes picking up this war, instead of any that might be in wwwroot/webapps.
Previously I had manually deleted app.war, but then the app would just 404. This leads to the second issue. I was attempting to deploy using the default package name "...SNAPSHOT"; however, Tomcat looks for ROOT.war. I added the following lines to my pom.xml.
This delivered the appropriately named file, which the "Azure App Service deploy" task places in wwwroot/webapps (where Tomcat looks for it). I then deleted the app.war file and any leftover ...SNAPSHOT folders in webapps, and restarted the app. It booted up with the war from the pipeline, as intended.
I will not be using the Azure plugin for Eclipse any longer, as it appears incompatible with Azure DevOps pipelines.