How to: Work with release definitions
VSTS | TFS 2018 | TFS 2017 | TFS 2015
This topic shows you how to:
- Create a new release definition
- Create and use environment templates
- Define processes in an environment
Create a new release definition
Open the Build & Release hub and choose Releases.
Choose the + icon and select Create release definition.
Select a template or start with an empty definition:
If a template is relevant to your scenario, select it to automatically add some tasks and apply typical settings. For example, if you select the Azure App Service Deployment template, you automatically get a task to deploy your app to Azure App Services.
If there's no template for your scenario, select Empty process and then add the tasks you need.
Specify the artifacts you want to deploy. Choose the type of source and specify the details such as the project and build definition.
Open the Continuous deployment trigger panel and set the trigger if you want a new release to be created when a new version of the source artifacts are available.
Check that the environment deployment trigger is set to automatically start a deployment when the release is created. You can also specify other pre-deployment conditions here if required.
Open the Tasks tab and select the default Run on agent item. In the properties panel, under Agent selection, check that Hosted is selected to use the default queue and agent available in VSTS. If you want to use a different agent that you have previously installed, such as an on-premises agent in TFS, select the agents queue.
Replicate a definition or environment
If your definition has a pattern that you want to replicate in other definitions, clone it or export it.
When you clone a definition, the copy appears in your list of releases. You can save it with a new name.
When you export a definition, you can import it afterwards. Then, if required, modify it and save it with a new name.
Create and use a template
Create a template for a definition from an environment within the definition by using the old definition editor.
After you create a template, it appears in the Custom tab of the Create release definition wizard. Your team members can use it to follow the pattern in new definitions. For more details, see Environment templates in Release Management.
Use the REST API
Create release definitions using the Release Management REST API.
Add more environments
A release definition, by default, contains a single environment. Configure additional environments in a release definition to represent the target server(s) or locations where you will deploy your app.
Open the + Add list and choose New environment.
The template selector panel opens. Follow these steps to configure the new environment.
After you have created and configured your environments, add tasks to them.
You can add environments using the Release Management REST API.
Clone an existing environment
A release definition often contains several environments such as development, testing, QA, and production. Typically, all of these environments are fundamentally similar - and the techniques used to set up and deploy to each one are the same with the exception of minor differences in configuration for each environment and task (such as target URLs, service paths, and server names).
After you have added an environment to a release definition and configured it by adding tasks and setting the properties for each one, clone it to create another environment within the same definition.
You can clone individual environments directly within a definition in the Pipeline tab.
Alternatively, select the environment you want to clone, open the + Add list, and choose Clone environment.
The cloned environment has the same tasks, task properties, and configuration settings as the original.
Define processes in an environment
The Tasks tab of the release definition editor shows a list of the task phases and tasks defined for each environment. Open the tasks list for an environment by choosing the "phases and tasks" link in the environment, or by selecting the environment name in the Tasks drop-down list.
By default, unless you chose the Empty process template when you created your release definition, the definition will contain a Run on agent phase. Add tasks to a phase by choosing the + icon in the phase item to open the Add tasks panel. Select the type of task you need (or choose All), or search for a task by name. When you find the task, choose the Add button that appears when you select the task.
A link at the top of the list takes you to Visual Studio Marketplace where you can download and install additional tasks.
You can add tasks specifically for execution on the deployment agent, on a deployment group, or on the server without using an agent by adding the appropriate type of task phase.
You can add tasks to an environment using the Release Management REST API.
Use task groups
A task group lets you to encapsulate a sequence of tasks already defined in a build or a release definition into a single reusable task that can be added to a build or release definition just like any other task. You can choose to extract the parameters from the encapsulated tasks as configuration variables, and abstract the rest of the task information.
For more details, see Task groups.
Release definition concepts
A release definition contains all the tasks and settings used to create a release and deployment to your target machines. To learn more about release definition settings, see:
Where can I learn step-by-step how to build and release my app?
How do I programmatically create a release definition?
Do I need an agent?
You need at least one agent to run your build or release. Get an agent.
I can't select a default agent queue and I can't queue my build or release. How do I fix this?