Creating new Team Build database build definitions

By Team.doom
Last updated: 24.07.2017
VSTS Team Build XAML

Intro

We have only been playing with vNext builds for a little under a year but have found it much more intuitive and easier to get to grips with than developing XAML (Extensible Application Markup Language), builds. The ability to comment each build so it is easy to identify what historical build was for what purpose and being able to compare changes across build definitions is awesome. This blog is just a quick run through of what Team Build it is, key features and then finally how to get up and running with the global database build templates.

 

What is it?

vNext aims to provide a new set of release management and capabilities and a simple and intuitive web browser. It forms part of VSTS (Visual Studio Team System) and contains tasks or deployment scripts that allow you to configure a definition for a build as well as providing easy to interpret version and work item changes across various environments. Also out of the box it has good support for both Windows and Linux applications.

 

Getting started

To get started navigate to VSTS and select the ‘Build & Release’ tab and then ‘Explorer’ from the drop down. Then select the plus symbol to create a new build definition…

We have created a number of saved templates for use with database definitions and if you select the ‘Custom’ tab you will see the following definitions…

 

The SQL server Database project is for SSDT (SQL Server Data Tools) solutions and the SSIS (SQL Server Integration Services) definition is Integration services solutions. If you then click on the relevant option then click next you’ll see the screen below…

Select the repo you want to use and the folder you want to store the definition in then click on ‘Create’.

Both the database and SSIS templates have been created such that you only need to configure a couple of aspects and the dynamic nature of the task groups that are used in the templates will create everything you need. The aspects you need to configure are the following…

Database build definition

BuildMajorMinorFeature (in the variables menu) – Simply need to put your build number here in the format X.X.X, the runtime generated build number gets post fixed on to this.

Repo mappings – The folder that stores the .sqlproj file in your solution needs to be mapped to the build source directory I.E.

If a cloak folder appears this also needs to be deleted.

 

SSIS build definition

BuildMajorMinorFeature (in the variables menu) – Simply need to put your build number here in the format X.X.X, the runtime generated build number gets post fixed on to this.

SSISProj (in the variables menu) – This variable name needs to be edited so that is contains the name of the .dtproj file of your SSIS solution.

Repo mappings – The folder that stores the .sqlproj file in your solution needs to be mapped to the build source directory and the vNext folder we have in source control also needs to be mapped to the vNext directory I.E.

If a cloak folder appears this also needs to be deleted.

Trigger

Another aspect to consider is the type of trigger that you want for your build. At the time of writing we typically use a gated check in but there are ongoing discussions to change our default to CI.

 

Key Features

This is not intended to be a definitive list but we just wanted to list some of the features we found cool and really nice to have over the xaml style builds that we were previously used to.

History

One of the menu tabs you can select is the History tab…

This allows you to view each change made to the definition along with notes for that change

Version comparison

If you then ctrl select two entries in the history list the ‘Diff’ button becomes unghosted and when clicked on compares the two definition to one another with coloured highlighting of your changes…

Task Groups

Task groups are a really powerful feature of vNext and effectively group up a list of tasks into a single list. This list can then be named and becomes selectable as a single task in any new build definition (this is what has been used for our templates). A task group allows you to create dollar parameters for most values and these parameters can be passed from one task to another in a task group…

By feeding in values for these parameters outside of the task group it allows for a powerful and versatile template that is easily configurable.

 

Conclusion

With not a huge amount of knowledge on vNext we were able to quickly build up a relatively extensive suite of build definitions that are capable of fulfilling most requirements. The interface is easy to use and self-explanatory and, as it is all browser based navigation, was very familiar. If you haven’t already we would strongly recommend taking five minutes and have a play.