How to Deploying to On Prem Servers(Linux) Using Azure DevOps Deployment Groups - azure-devops

I created a deployment group and able to create a agent on my server (linux machine) . Target machine was set. All I need was to create a release pipeline, So I created a release pipeline and select artifacts from build ( I already build that).
For Stage I select empty job and then select “Deployment Group Job” , Add my deployment group that I created and save the changes.
I select another task i.e “Copy Files” that copy files from artifacts to “/var/www/html” on my server(linux).
After this I run the release and deploy it. It succeed but what is does, that it copy zip file to the path I provide on my server.
/var/www/html/11.zip
That is not what I want. I want that it unzip the artifact that was built and deploy code to path I mention so that I can run my application there.
I may be choosing wrong task. But all I need it to run my application from my server. If I need to add some different task , what are those ?

If I need to add some different task , what are those ?
Since you need to deploy Unzipped files to the target path, you can directly use the Extract files task to replace the Copy file task in Deployment Group.
Here is an example:
In the Destination folder field , you could input the target path.
Then this task will unzip the zip file and send the unzipped files to the target path.

Related

Azure DevOps link release pipeline to deployment group

I am working with a self-hosted agent to release code into a target on-prem server. In my case, I just want to copy a file from the artifacts directory (.exe file) into a folder on my machine. So I created a deployment group and installed the on-prem agent on this server. I created the release pipeline...but since I am just copying a file, I couldn't use one of the predefined templates. So I started with Empty Job. Then I added a step to copy the file using the "Copy Files" step. However, no where in this process is there a place to associate a deployment group. Some of the pre-defined templates have the option to specify the deployment group. But in an empty job with an added step, how do I specify the deployment group? Any ideas?
I was able to add a Deployment Group Job in the Tasks section of the pipeline. Originally I was using the default Task which was running on a Microsoft agent. So was able to delete that one and add a Deployment Group job.

How do I use an Azure DevOps Services Build Pipeline to retrieve TFVC source files based upon a Label value and then zip those files?

This is a TFVC repo in Azure, not Git. It is running in Azure DevOps Services, not local in Azure DevOps Server (2019). This is a classic pipeline, not YAML.
I got as far as adding a variable that contains the Label value I am looking to package into the zip file.
I can't figure out how to get the sources by Label value. In the Pipeline Get Sources step, I've narrowed the path down, but then I need to recursively get source files that have the Label in the variable I defined.
The next step is to zip those source files up, I've added an Archive task to which I will change the root folder from "build binaries" to the sources folder.
This is necessary for this particular project because we must pass the source files to the vendor as a zip for them to compile and install for us. The developers create/update the source files, build and test them locally, then apply a Label to the sources for a given push to the vendor.
When configuring 'Get sources' step, there is no any option or method that can only map the source files with the specified label.
As a workaround, in the pipeline job, you can try to add the steps to filter out the source files with the specified label, and use the Copy Files task to copy these files to a folder, then use the Archive Files task in this folder.
[UPDATE]
Normally, a pipeline run will automatically check out the file version (changeset) that triggers the run. If manually trigger the the pipeline, by default the run will check out the latest changeset if you do not specify one.
The labels are used to mark a version of a files or folders, so you also can get the specific version of files or folders via the labels.
In your case, you can try using the 'tf get' command to download the files with the specified labels.

Execute SQL scripts on VM Machine using release azure devops pipeline

I am using IIS Deployment template in Release pipeline to deploy MVC application to VM and it is working fine. But after deploying application, we want to run any ad-hoc sql changes using script files in SQL server using custom task Run SQLCMD Scripts from VSTS market place.
Relese pipeline, scripts are in zip file, Can anyone suggest what we should key-in in "Path to folder containing SQLCMD script files"?
You can try referencing the variable
$(Build.ArtifactStagingDirectory)
In Release Pipeline, the artifacts will be downloaded to the path : $(System.ArtifactsDirectory).
According to your screenshot, I noticed that you are using the "Extract files" task. This task will find the zip files in the $(System.ArtifactsDirectory) and extract it.
The unzipped folder name is set in the "Extract files" task (Destination folder).
So you could try to use the following path:
$(System.ArtifactsDirectory)/Destination folder name
You can also expand this path according to the actual location of the file.
Hope this helps.

VSTS performs web deploy successful, but website does not work

I am trying to get Visual Studio Team Services (VSTS) to perform a web deploy of my app. According to the VSTS UI the web deploy is successful, but when I browse the deployed web site it shows the default IIS screen ("Welcome - IIS").
This is my publish step in the build pipeline:
This is my release definition:
This is the resulting deploy folder:
Build.log (with replaced values) - https://drive.google.com/file/d/1y6q2Cjr1gxBVMcHeh6n_r7qu-JpJFSyC/view
Do I need to add an additional step to the release pipeline to get the .zip files extracted?
You do not need to add an additional step to extract your zip, but you need to tell the IIS Web App Deploy task to deploy your zip file and not a folder. You have specified a folder for the Package or Folder input, so the task is doing exactly as you told it to do, deploy the specified folder.
If you only have one zip file in your build artifacts, the default value for this field, $(System.DefaultWorkingDirectory)\**\*.zip, will pickup your zip file and correctly deploy it. If you have multiple zip files in your build artifacts, you will need to specify the full path to the zip file in order for it to deploy.

How do you deploy a release to a sub folder without changing the physical path on IIS

We created a release definition that deploys our build to a onsite IIS server. We need to be able to deploy to a subfolder (e.g. D:\apps\appname\v1\[deploy here]. We tried changing the Physical Path setting in the IIS Web App Manage task, but that changes the Physical Path of the entire IIS server.
How can we specify where we want to put our individual application?
The problem with the IIS Web App Manage task is that it wants to configure and create IIS Web Apps, not just copy files. To just copy files you want to use the Copy Files task. If you're working with a remote machine, make sure you're running the Copy Files task on your deployment group. To do that, in your Release Definition, make sure your task is running under a Deployment group phase that specifies your Deployment Group.
Once you have this set up, your deployment should run, and it will run from whatever machine you configured in the Deployment Group. You can copy files from the build's artifacts to a folder using a path local to that machine. So for example if your IIS Website is located at d:\websites\MySite you would use that as the destination path for the Copy Files task.