Adding release management environment templates to your VSS extension

One of the easiest way to create a Release Definition is by using a pre-created environment template. If you have ever authored a release definition, you would have seen this pop-up while adding a new environment -

This lets you choose a template from system templates, or you can save your own environment as a template and re-use them while creating new environments. As an author of a vss extension you can now define environment templates which will be available to all users when they install the extension.

Steps to add an environment template to your extension

  1. The contribution that the extension needs to target to add environment templates is ms.vss-environmenttemplate.environment-template
  2. All the changes to describe this template go to vss-extension.json file of the extension.
  3. Define your template with the following properties (the payload looks like any other environment template) -
    • Id - A guid to uniquely identify your environment template.
    • Name - Name of the template that will show up in the popup shown above.
    • Description - Describe what the template can do
    • Variables - A set of RM variables that the environment will be set up with.
    • DeployPhases - A list of the deploy phases that will be executed when the deployment begins. Each deploy phase will have its own set of tasks to be executed by the agent.
  4. Add an icon to represent the template.
  5.  Build and install the extension! The template should be available in templates list now.

Link to the Release Management extensions repo on GitHub that has a sample extension published.

If you are new to writing extensions, this link will be useful.