Tidy up those VSTS release pipelines with meta-tasks

Do you have repeating blocks in your VSTS release pipelines?

I certainly do. A common one is to run a set of functional test, so I need to repeatedly …

  1. Deploy some test files to a VM
  2. Deploy a test agent to the VM – IMPORTANT I had not realised you can only run one test run against this deployed agent. You need to redeploy it for the next run
  3. Run my tests
  4. … and repeat for next test type/configuration/test plan/DLL etc.

In the past this lead to a lot of repeat tasks in my release pipeline, all very messy.

Now in VSTS we have the option of  Meta-tasks, these allow tasks to be grouped into in-effect functions with their own properties.

image

In the above screen shot below you can see I use a meta-task ‘Run Tests’ that wrappers the four tasks shown below.

image

Much neater, but as you might expect with something new I have come across a few minor gotchas

  • You cannot order the list of properties for the meta-task
  • This is a problem as the first one is used to generate the instance name in the pipeline. No a major problem you can always edit it.
  • Meta-tasks properties are auto-detected from any variables used with in the meta-task tasks, the auto-detection mechanism is case sensitive, unless the rest of VSTS variable handling. So be careful to not end up with duplicates.

That all said, I think this is big step forward in readability and reuse for release management