0

I am deploying our NodeJS application to our Azure App service using Azure's local git. What I am basically doing is making our CICD pipeline git commit our changes and do a force push to Azure's Local Git. Then, Azure will build the application from the committed files, which seems to be working fine.

But today, I have made a shocking discovery, after couple of weeks of deployment, the files in the wwwroot folder does not match the files in the Local Git Repo. The files that do not exist anymore in the Local Git repo are still in the wwwroot folder

For example, the git repo contains the following files under prisma/migrations

enter image description here

But in the Azure App service wwwroot folder, the same directory contains more than that:

enter image description here

So, these files are actually from previous deployments that do not exist in the latest version of the master branch of the Local Git.

Upon looking at their deployment step, I learned that they are simply copying whatever files are created in their deployment "Oryx/Kudu" deployment step into the wwwroot folder without checking if there should be files needed to be deleted:

enter image description here

If this is the case with this approach, is there a proper way to do this? Or is there a quick way to clean the existing wwwroot folder first before their deployer copy the files?

Hope somebody can help.

Thanks!

1 Answer 1

1

If you use the Azure App Service Deploy task in Azure DevOps Pipeline to deploy your application and select Web Deploy method option, there is an additional option to Remove Additional Files at Destination.

enter image description here

If you check this option, the deployment process will remove any files at the destination where there is no corresponding file in the package that is being deployed.

In other words, it'll remove any left-over files from a previous deployment that are no longer required.

Please refer to the similar ticket: How to clean up wwwroot folder on the target Azure Websites Windows Server before each deployment in VSTS.

1
  • are there other options I can have without having to setup Azure DevOps?
    – arvil
    Commented Dec 20, 2022 at 12:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.