I'm setting a CI/CD using Azure Pipelines. As the output of the build, I'm generating a zip file. If I manually upload the produced zip artifact to wwwroot using Kudu, it works fine. However, using the Release of Azure Pipelines, it's creating a new folder and dropping the content into it.
Kudu:
I've tried several different approaches:
-without zipping the output of the build
-using msbuild rather than dotnet build
-deploying using msdeploy
-cloning from existing builds / releases
For all the previous approaches I'm getting the same result: the output inside Backoffice folder. I've found a similar problem on VSTS release pipeline to Azure web app deploys to wwwroot subdirectory but I did the steps described in the answer and I'm still with the problem. Any clues?
I was able to solve this issue using the Zip Deployment from preview version.
Related
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
But in the Azure App service wwwroot folder, the same directory contains more than that:
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:
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!
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.
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.
I have created the azure build pipeline for my website application. In this, there is a task of Publish Artifact Which I think supposed to publish a website. But right now it is publishing without the dlls. Means it contains the *.aspx and *.aspx.cs files. It supposed to create the dll files for *.aspx.cs files. Could you please let me know which publish option/task I am supposed to choose for my website. Which will be equivalent to the "Publish Web App" command in the azure build pipeline.
right now it is publishing without the dlls. Means it contains the
*.aspx and *.aspx.cs files.
For this issue, I tested publishing the website to local in vs. From the local file directory, we can see that the dll files are in the Bin folder. You can set the system.debug=true variable when running the pipeline, so you can track which folder the dll files are published to in the build solution step in the log.
About publishing artifact process:
Artifacts are the files that you want your build to produce. Publish artifact task is used to publish artifacts for the Azure Pipeline.
In the agent there are 3 folders: a, b and s. The variable $(Build.ArtifactStagingDirectory) point to folder a (artifacts). When you build the code all the code and the artifacts exist on folder s (sources), the best practice is to copy only the artifacts to folder a and then use the task "Publish build artifacts", in this task you take the artifacts from folder a and put them on Azure DevOps storage or in your file share.
If you save the artifacts in Azure DevOps you can access your artifacts from the build summary page or create a release pipeline. if you save them in a file share you can just access them there or in the release pipeline.
In addition, you can share your build definition and msbuild arguments for further investigation.
I am new in Azure DevOps. I have configured a pipeline for Continuously Deploying application on IIS Server. Right now its working fine but my issue is how can i Skip/Exclude some files and folders (Configurations files, Documents folders etc.) from Publishing Artifacts and Deploying the application on IIS Server.
I did some R&D internet on it a find a solution in shape of .artifactignore file. But this is not working OR maybe i am doing wrong. I did as explained here.
Is there any other ways or any one can explain this to me.
ON deploying from TFS 2015 to onpremise Server,it deletes empty folders in App Data Folder.I want to include the empty folders in AppData and set Read,write/full control permissions to that folder.I use WINRM IIS Web Deployment task.
This is how the feature has been designed. Take a look from our MSFT'S reply at this similar question: Publish Artifacts task does not copy up empty folders
I can confirm this is by design. I am assuming you are uploading
artifacts to Azure DevOps Service rather than to your own file share.
You should think of Azure DevOps Service's artifact storage more like
blob storage than a giant file share.
I see you say you need these empty directories at deployment time. Can
you create them as a step during the release rather than as a step
during the build? I would say that fits best with the build vs.
release abstraction.
Compressing all of your artifacts into a .zip before you copy them to
the artifact staging directory should also work. You will just have to
unzip them as part of the release.
As suggested, you can create the empty folders via a script to workaround the issue. It will also apply to the situation if you choose to publish to file share path. Besides, you could also zip the artifact and upload and unzip it during release.
I have a .net core web app (NopCommerce 4.1) that I am attempting to setup a build and release pipeline for.
However, when I setup the pipeline my deployment is failing because it attempts to create a folder, but write rights do not exist. I have confirmed this with Kudu where I get an error message (409) when attempting to create a folder via the cmd shell.
NopCommerce requires a couple of folders to be editable, but azure pipelines deploys a zip folder and creates a folder structure that is read only.
I want to deploy to a dev, test, prod environment with a folder structure that is editable (as nopcommerce creates folders and writes files to them dynamically).
I followed the following YAML structure:
https://damianbrady.com.au/2018/10/11/what-yaml-do-i-need-for-azure-pipelines/
Is there a way to create a build / deployment that will deploy either:
1. The files without zipping
2. Transfer a zip, unpack into a folder structure with execute/modify/create permissions
1.The files without zipping 2.Transfer a zip, unpack into a folder structure with execute/modify/create permissions
We could use the Azure kudu Zip API to do that.
Note:It is not recommended for deployments Kudu's zip API.
Kudu Rest API is an effective way to move multiple files to your site, but zipdeploy is preferable for deployment For more information please refer to this document.
In your case, you could use a Powershell task with Powershell script to invoke Kudu Zip API to do that. For information about how invoke REST API with Powershell, please refer to this SO thread.