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.
Related
I'm just trying to get my fist Release pipeline underway.
Our current infastrucure setup is that we have a number of On Prem VM's which I have deployed the Azure Agents as per the deployment group setup.
The issue I have at the moment is that the deployment first tries to download the artifact from our build server using a file share.
However, currently the deployment machine cant see the file share. I gather I am supposed to be able to see the file share. I'm not entirely sure how to share this folder on the build machine?
Am I supposed to just create a share for everyone to see? Or is there a particluar user/role that I am having to share it for?
Our current infastrucure setup is that we have a number of On Prem VM's which I have deployed the Azure Agents as per the deployment group setup.
You need to check which user is used to run the tasks on the agent. You can add a powershell task with inline script: whoami.
You need to make sure the account have access to the file share.
In addition, when you publish artifact, you can select file share to store the artifact and then you can consume the artifact in the release pipeline. Please check the link for the details.
My "Download artifacts from file share" in release pipeline screenshot:
I have an app service which is deployed to Azure WebApp for testing (this works just fine), but since this eventually shall be deployed to an on-premises solution I need to create a deployment package that I can download from either Azure Portal or from DevOps.
So far I have tried creating a Releases pipeline which picks up the build artifact and use the AzureBlob File Copy task to copy the artifact from DevOps to a storage account in Azure. The problem I have now is the the File Copy task does not set the varialbes I have in the Variable groups into the appsettings.json file (such as DbConnection and port settings).
What would be the best way to create a deployment package (with updated appsettings.json values) to be available for download either from Azure Portal or DevOps, without the need to create a dedicated app service in Azure for the deployment?
This is the steps I have at the moment, but as mentioned the configuration property for setting the varialbes are not available for the AzureBlob File Copy:
Pipeline Tasks and Variables
How to deploy app service with pipeline variables as an artifact to be downloaded?
You could try to use the task File transform (Preview) to update the appsettings.json file with the value in the variable groups:
Then we could use the Azure File Copy task to copy the artifact from DevOps to a storage account in Azure.
Note: The Source of the Azure File Copy task should be use the $(System.DefaultWorkingDirectory) instead of select the repo file:
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.
We have a .NET Core Console App which we publish to an On Prem VM using publish feature in Visual Studio. Here is how we configure publishing to a file system.
Target location in the image is actually the folder structure of where we want our app to reside on the VM.
How can we configure the same in DevOps. I can't seem to find any good resource on this.
I have created a CI build pipeline.
You can follow below steps to deploy Console App to the On Prem VM.
1, Create a deployment agent on On-Prem VM. create a deployment group from azure devops portal. Follow the first part of this tutorial to create deployment group. Check the official document for more information about deployment group.
2, Create a release pipeline. See document here.
Setup the artifacts(you should have the publish build artifacts task in the CI build pipeline to publish the console app build artifacts to azure devops server.), and add stage for the release pipeline.
Add a deployment group job in the release stage.
see below screenshot to select the deployment group created in the first step, which contains the deployment agent on the ON-premise VM,
Add copy file task to copy the console app build artifacts to the folder on the ON-premise VM
Another workaround is to use self-hosted agent(steps are similar to above using deployment group). Check the detailed steps in this example.
Hope above helps!
I'm building an Azure DevOps pipeline to deploy a custom-build powershell application to several on-prem environments that we support. I configured the required agent pools and installed them as a service on the on-prem environment.
Next, I have set up my pipeline in Azure DevOps, selecting a GitRepo:
Build (with the steps: Use Nuget, Nuget Restore, Build solution, Update version, Copy Files, and Publish build Artifact)
Release (with step: Publish Build Artifact)
Some things are unclear for me:
Do I need the Publish Build Artifacts twice? Can the Build pipeline
end with Copy Files step, and that the Release pipeline picks up this
artifact?
It is my understanding that the release publishes the app to the
on-prem environment (in my case). Where can I set a custom path (ie:
C:\deployed_apps) where the app needs to be deployed? When I tested
this pipeline, I got errors that the path I created using an variable
was not found.
What am I missing in my setup to get this pipeline working?
As #Shayki Abramczyk
pointed out this task is not for deployment, it just upload your Build Artifacts to azure devops server where your release pipeline can download directly.
In your case, if you want deploy your application to several on-prem environments, You need to create a deployment group first, A deployment group is a logical set of deployment target machines that have agents installed on each one. You application will be deployed to those machines in a deployment group in release pipeline. Check here for more details about deployment group.
After the deployment group is created, you can add a deployment group job by click the 3 dots, and then specify your deployment group as below pic shows, You can then simply add a copy file task or other deployment tasks to deploy your application to your on-prem machine.
In the release pipeline you shouldn't use the Publish Build Artifact. in the end of the build you put this step, what this step does? upload your artifacts to the Azure DevOps or to a file share. now in the release pipeline you choose the build artifact (in the left pane). the first thing that the agent does when the release pipeline started is to download the build artifacts to the agent. now you need to take them and deploy it to your environments. how? it depends which kind of application is (it can be just copy files, it can be deploy to IIS, etc.).
You can put the path in the variables tab and use this variable when you deploy the app (with copy files task, for example).