CI/CD, TFS, VSTS

Continuous Integration using VSTS (Visual Studio Team Services)

Continuous Integration in VSTS is very easy process by doing few configuration as per your requirement and it is very robust to adapt to any environment like .net, Java, ROR, Python etc.
To start with VSTS, please follow below steps.

First, you have an account in VSTS to add your project with any source control like Git, TFS, VSTS, etc..

Create a new account in Team Services

Create VSTS Account

I have created a simple web application (My App) in mvc with Git as a repository and added project in VSTS.

I have committed all the code from Visual Studio to VSTS by setting Git as a version control.

Now to generate CI process, you need to create a build definition by selecting your project go to Build & Release -> Builds tab -> click on [+ New definition]

After clicking on new definition you need to select a template for a CI process in which multiple layers are defined based on the template you choose. I have choosen ASP.NET(Preview) template because I have web application in Asp.Net MVC.

After selecting the template I have some predifinded tasks as below in which first level is to give name of CI process which will be the unique identifier to recognize particular CI process and also you need to select hosted agent which is usefull to track all your CI build and do further operations.

The next task is to choose your repository from which you will get your committed code to be built and also you can set particular branch of that repository. You can create a Build definition for each branch, but the name should be unique.

The next task is for NuGet Restore which is default given in this template, but you can select any package management like NPM, Bower etc..
You can add more tasks by clicking on Add Task for android, ios, Java , aws, azure etc..

Even you can install some new component in your VSTS account from market place.

For this project you require MSBuild to generate dlls and pdb files for your .net project so the next task is with MSBuild in which you can choose your solution file with visual studio version  and MSBuild runtime arguments.

You can remove unwanted task from build definition by right click and choose what you want like remove or temporarily disable it.

The last task is to generate Artifact which is one kind of package after successful generate build in which all latest committed files. You can set display name path to store Artifact those path is come from variables which is predefined variables as you can see the tab variables.
Now the important step is to make the CI process automated by setting trigger which is also accepting only changes for a particular branch committed code.

You can even schedule your build process rather than depend on each commit for example, you can set CI process on the end of the day so all your changes are included in build and can move to the next step.

In the Options tab, you can configure your build number format with date and branch and also the revision number.

In the Retention tab, you can manage your last build records and sometime it is usefull for rolling back all your changes by simply select particular build.

For each build there is history data has been maintained and can see in history tab.
Affter configuring above steps you can save your build definition or save and queue to run it instantly.

After adding build process into queue you can see on top of all the tabs with build number.

When you click on that build is it run on background but you can see it and analyse each and every steps with consolidated output window for each task. Even you can see each task status and overall status with log and code coverage (which is usefull for test cases).

You can explore or download your artifact generated by build process.

So finally artfact has been created and stored in configured path with build number and it will be refered in CD process for the deployment in different servers.

Tagged , ,

Leave a Reply

Your email address will not be published. Required fields are marked *