09Jul

Setup Jenkins for VSO with TFVC

Jenkins provides an easy-to-use Continuous Integration method, making it easier for developers to integrate changes to the project.

We can use Visual Studio Online (VSO) to store code and use Jenkins for Continuous Integration builds.  A Jenkins build can be triggered when code is checked into TFS with TFVC as the code repository.

In this blog, I am showcasing the ability of using TFS Version Control of a team project setup in VSO for Jenkins build system.

 

Pre-requisites:

1.      Visual Studio Online account with a Team Project with Version Control as source repository

2.      JDK, JRE latest version setup and environment variables configured

3.      Jenkins instance up and running

 

 

Login to the VSO account and navigate to the team project.

Jenkins1

 

Normally, when we configure Jenkins along with on premise TFS, we have to specify the location of TF.exe (usually C:\Program Files (x86)\Microsoft Visual Studio <>\Common7\IDE\TF.exe) which is used in retrieving the source code from TFS for execution of the build.

Source Code Access on TFS is provided through the <> and <>  at Jenkins level. The same configuration does not work with VSO without providing the complete email - Microsoft ID credentials <>.

TF.exe does not support VSO login which makes it impossible to use Windows ID credentials unless pre-cached.

 

Jenkins2

 

To use VSO, we need to make use of Team Explorer Everywhere (TEE) Command Line Client (CLC), i.e., TEE CLC.

Download the TEE CLC 2013 or later version.

Once the package is downloaded, unzip the file and configure environment PATH variable for the same.

Now, let’s configure Jenkins instance to make use of TEE CLC to build the VSO project.

Access the running instance of Jenkins, click on “Manage Jenkins”à “Manage Plugins”. Switch to “Advanced”.

Download the latest file from the below 2 URLs

·        TFS Plugin – https://wiki.jenkins-ci.org/display/JENKINS/Team+Foundation+Server+Plugin

·        MS Build Plugin - https://wiki.jenkins-ci.org/display/JENKINS/MSBuild+Plugin

And save them with extension – “.hpi “.

Upload these 2 files under the “Upload Plugin” tab.

Jenkins3

 

Once the files are uploaded, restart the Jenkins service in “Services.msi”.

Jenkins4

 

Configure TFS Plugin and MSBuild Plugin under “Manage Plugins” --> “Configure System” --> Team Foundation Server and MSBuild respectively. Restart Jenkins service.

 

Jenkins5

 

With these configurations completed, we can now create a new Jenkins job to start the actual build execution.

Navigate to Jenkins home page, click on New Job, give a name and choose the type of project (Here, i have used Freestyle Project) Jenkins6

 

Before we configure Jenkins to get source code from VSO for build, since TEE CLC is a new client, its End User License Agreement (EULA) has to be accepted.  This being a command line client, we do not get any UI for accepting the EULA. We need to configure this as a job and execute the agreement.

Scroll down to Build section under the job, choose “Execute Windows batch step” and in the box, provide the command – “ tf.cmd eula –accept

Jenkins7

 

Without any further configuration, save the job and click on “Build Now” in the job homepage.

With the job execution, the output window looks similar to the below image –

Jenkins8

 

Now that the EULA has been accepted, we can configure the job to retrieve source code from VSO and proceed with the build.

 

Create a new job / Open the executed job and scroll down to “Execute Windows batch” step. Delete the EULA accept command.

Now scroll to “Source Code Management” section. Under this, input VSO project related values.

1.      Choose Team Foundation Server from list of options under Source Code Management

2.      Server URL should have information upto the Collection level. Ex: (http://abcd.visualstudio.com/DefaultCollection)

3.      Project path should resemble the server source code path. Ex: ($/FabrikamFiber/Dev)

4.      Login name should be the complete email-id for VSO login ( IMPORTANT : It is mandatory to have the alternate credentials enabled even though it is not being used explicitly) Ex: liveid@domain.com

5.      Enter the user password.

6.      Leave the other fields as is with existing values unless you need to change.

7.      Save changes to the job and trigger a build.

 

Jenkins9

 

Scroll down to Build Section with the Job creation page to configure the project/solution that needs to be compiled.

In the Build section, click on Add Build Step and Choose – “Build a Visual Studio Project or Solution using MSBuild” from the list of options.

In the same section, choose the MS Build Name/Version from drop-down, the Solution file (sln) or csproj file for the particular project to be compiled and the minimum option as build argument – “/t:build”. Save the changes and trigger the build by clicking on "Build Now" link.

Jenkins10

 

With the correct configuration, the build should succeed with success message in output console.

 

Jenkins11

 

Related

Create a Virtual Wi-Fi Hotspot for Windows 7 & 8

In this blog, I have added information on how to turn your windows 7 or 8 machine into a Wi-Fi Hotsp...

Read More >

Sonar Integration with TFS for Java Projects

 Sonar Integration with JAVA.1.Download sonar-3.7 and sonar-runner-2.3*** unzip folders and cop...

Read More >

Introduction to SharePoint and its features

This article will explore about the SharePoint introduction, its version and features.SharePoint is ...

Read More >

Why customer should choose Azure DevOps

Azure DevOps is rebranding of Microsoft’s Visual Studio Team Services (VSTS), which is the onl...

Read More >

Upcoming Webinar - Plugging for Cloud, Right or Wrong?

Plugging for the Cloud, Right or Wrong?Cloud computing continues to be one of the most advertising t...

Read More >

New Tools in NAV 2013 (the less talked about ones) - Concluding Part

This part (as I said in my previous blog), will contain some more new tools and features focusing on...

Read More >

Webinar - Plugging for Cloud, Right or Wrong?

Please watch LIVE RECORDING Video of the webinar session below which took place on 28th Ja...

Read More >

ViewData and ViewBag in MVC

ASP.NET MVC provides us two options ViewData and ViewBag for passing data from controller to view.Vi...

Read More >

Canarys is a finalist for 2014 Microsoft ALM partner of the year award from INDIA

Bangalore, Karnataka, India — May 29, 2014 — Canarys, today announced it has been named ...

Read More >

Bugzilla - TFS Migrator

Bugzilla to TFS 2013 MigratorSeamless, Stress-free and Simplified Migrations using CDMT “Canar...

Read More >

Share

Comments

Thanks for sharing this.
10/9/2019 10:27:29 AM | Reply

Post a Comment

  • Recent
  • Popular
  • Tag
Tags
Monthly Archive
Subscribe
Name

Contact Us
  • *
  • *