Are there seperate VSTS agents for build vs release? - azure-devops

I am getting my first VSTS build and release definitions setup.
Test server destination, on prem
project is using VS 2017 professional
Earlier I setup a private agent for doing the build, following this.
https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows?view=vsts
The agent installed fine and I can see it from build & release / agent pools
However, have now switched to using a hosted agent for that so I can remove the need to install visual studio on a test server.
Now I want to deploy the build to my test server, which is on premises. Do I need yet another agent or can I use the one I setup already. In other words are build agents separate from release agents? The agent I setup earlier is running as a service.

The build agent can be used in VSTS build and release, also the deployment group agent is configuring with build agent too.
You don’t need to setup another build/release agent, there are many tasks to deploy app to another server, such as IIS Web App Deployment Using WinRM, PowerShell on Target machine, Windows Machine File Copy.

The build and release agents are the same, but you have to install an on-premise agent to deploy your projects in your network. Is not that you can not use the hosted agent, but you would have to use WinRM and open you network, which may not be a good idea.
After you installed your on-premise agent, you don't have to install VS on the machine to run tests. You can add the following task to your release.

Related

Azure Pipelines - Clone or Copy Hosted Agent

Is it possible to clone or copy an Azure Pipeline Hosted Agent for use as a Self-Hosted Agent?
I'd like to reuse one of the Hosted Agents simply to enable me recreate and reuse all of its
capabilities, saving me the headache. Is this possible and if so I'd really appreciate some help.
Thanks
This is not possible, but you can try to reuse what is already available here https://github.com/actions/virtual-environments
This repository contains the source used to create the virtual environments for GitHub Actions hosted runners, as well as the VM images of Microsoft-hosted agents used for Azure Pipelines. To file bug reports, or request that tools be added/updated, please open an issue using the appropriate template. To build a VM machine from this repo's source, see the instructions.
So you can use the same scripts which are used to create Microsoft Hosted agents.
There is no such build-in feature.
Azure DevOps provides free hosted agents that have a predefined set
of tools installed and configured for building and releasing your
apps.
There is another option where you set up and manage your own agents.
This can be done by simply downloading the agent package, and run it
either on your local machine or any other computing platform even on
Docker container. It also gives you more freedom to install specific
dependencies for your build and release.
If you want to build your own agent during the pipeline. I would suggest you use Docker container to handle the process.
Microsoft has already created pre-configured container images on Docker Hub for everybody to use. But they’re Linux based and don’t contain any additional applications and/or packages so you’d probably still need to add those every time you run your build.
This repository contains images for the Visual Studio Team Services
(VSTS) agent that runs tasks as part of a build or release.
VSTS agent images are tagged according to the base OS, an optional
Team Foundation Server (TFS) version, and tools that are installed.
When used with VSTS, the agent version is automatically determined and
downloaded at container startup based on the account to which the
agent is connecting.
More detail step, you could refer this article: Build your own Azure DevOps agents with pipelines

Run task on target Machine during release in Azure DevOps?

In my current organization we are using Azure DevOps Server (on-prem) to release our products. The current setup is that we have a bunch of build and release agents running on a set of VMs.
The servers that we actually release to are different machines than the ones running the release and build agents, therfor we end up using alot of "PowerShell on target Machine" tasks during the release to configure and setup dependencies for our products.(asp.net websites in this case)..
However.. what I find strange is that due to this setup we cant really utilize other tasks to setup our environment/target-machines. For instance, lets say that we would like to use the "extract files"-task, then this would not be possible since the extraction would happen in our agent and not in our environment/target Machine.
Are we missing something or are you actually supposed to basically only use the "PowerShell on target-machine"-task for such a scenario?
You are right, most of the tasks are running on the machine of where the agent is installed. if you want to run the agent in one VM and deploy with this agent to another VM you can use out-of-the-box with the PowerShell on target machine or Copy files to remote machine, or SSH tasks.
But, in the marketplace you can find many tasks that can do things to remote machines, include zip or unzip files.
If you can it's really recommended to install the agents on your target machines.

Could not able to create an executable(.exe) from Azure Devops pipelines release

I am working for a WPF application, and recently I have migrated TFS to Azure DevOps and I am successfully able to create build artifacts as well, unfortunately, I could not create executable from the artifacts as Azure DevOps does not support InstallShield Package creation with it, now I decided to move the build artifacts to my local build server,again my company law doesn't allow to access my server from outside network, what should do to create executable.
The Build Agent needs to be able to connect to Azure DevOps. It's enough for it to be able to make an outgoing connection over https (443). The agent can be configured to connect through a web proxy server.
What alternatives do you have:
Use the hosted agent and install InstallShield as part of the build process. This will be slow, but it is doable. You'll need to execute this step as part of every build that tries to create the InstallShield package and requires you to do a head-less installation of InstallShield (given that they are the kings of Installers, I suppose this is doable).
Use a private agent in Azure. You can spin up any IaaS server on Azure, install Visual Studio, InstallShield and the Azure DevOps Agent on it and use it as a build server. There is a set of standard images file available which you can use as a basis.

VSTS Continuous Delivery to non-Azure web server

It doesn't look like this is possible but is there a way to use VSTS Continuous Delivery and deploy to a server outside Azure?
Sure. VSTS Continuous Delivery can deploy to anything that can run the VSTS agent or anything that can be targetted from a VSTS agent. Basically you have two options:
Let the VSTS (hosted) agent communicate directly to your deployment target. Out of the box tasks can use MsDeploy or WinRM. There are also tasks for Octopus Deploy, AWS and other systems available through the Marketplace. Powershell has options to connect directly to other systems and you can use many different protocols from a powershell script.
Install the VSTS agent on your target machine (or network). The VSTS agent can be downloaded and installed onto the target server. That way you have full local access to the target machine and can simply copy the files to the target folder straight from the Release Management artefacts. By installing a VSTS agent in you local network, you can use the options listed under 1 to bypass firewalls that might be blocking the hosted agent.

Configure VSTS local build agent for deploys

I have a local VM that has successfully been running builds from VSTS.
After the builds are completed I have a deployment job that pushes my artifacts to a number of servers. This has been working fine for the past few months.
This morning, I received a message that I was out of "deployment minutes" and my deployments failed, however my builds completed.
Obviously it was building locally, but deploying in the cloud.
Is there a way I can configure my agent or my deployment job within VSTS to use my local agent?
You should just be able to switch your release definition to use the same agent queue as your builds. In each environment, click on each phase and change the agent queue it uses from "Hosted" to whatever you named your local agent queue.
You may need to install additional software (Azure PowerShell, if you're deploying to Azure, for example), but it will work the same -- the build and release agents are exactly the same software and use exactly the same tasks.
You should be able to add your agent to the pool (it requires some software installed there of course) and then select it instead of a hosted environment in the deployment step configuration:
Agent pools
At the bottom you can find:
The hosted pool provides all VSTS accounts with a single hosted build agent and a limited number of free build minutes each month. If you need more hosted build resources, or need to run more than one build concurrently, then you can either:
- Deploy your own on-premises build agents
- Buy additional hosted pipelines
Here is where I finally found the option to specify which agent the release should run on: