Build configuration as code and store it in version control was a request from some time back. It is great to have your build definition as code alongside your application source code. Microsoft has now released preview of YAML builds for this purpose to VSTS. Even though as of now it is limited to use with VSTS GIt and GitHub, version control (TFSVC not supported) to create CI builds, it is just the beginning of a new way to think about defining CI, CD pipelines and it will evolve into much greater levels in the future. Let’s get a basic YAML build done to understand what it is.
Showing posts with label CI Build. Show all posts
Showing posts with label CI Build. Show all posts
Tuesday, 21 November 2017
Thursday, 26 June 2014
10. Create a Simple Application and a CI Build - Setup Virtual Environment for TFS 2013 - Using Virtualbox
Now we are ready with TFS, Build Server and Development machine in our ALM demo environment (Virtual Environment for TFS 2013), and it is good time to create simple application and a CI build for it. If you wonder what is a CI Build and why we need it refer my post “Why CI build”.
Let’s create very simple Asp.Net Web Forms application first. Here I do nothing but use the template to create a simple app.
First a VS Solution.
Next add a ASP.Net Web Forms Application.


Now we have a basic Asp.Net Forms Application up and running.


Let’s check in this to TFS.

Now we have a simple application checked in to TFS.
Our next goal is to set up a CI Build, which builds for each changeset we check in. A new build definition can be created by navigating to Builds from Team Explorer Home, and clicking on New Build Definition.

Build name specified as “DemoWS.CI”.
In the trigger we have to set as Continuous Integration to make the build trigger for every check in.
Source settings we have to specify the correct source mapping.
In the Process tab of build definition we specify solution to build and we are setting build agent tags to correctly locate the build agent.

We are setting at least a build agent with VS2013 available should be located when the build is triggered.



Configuration to build we are selecting in this demo is Release and Any CPU.


We do not want to keep all successful builds in a CI build, since this is just a verification of latest source state of success compilation.
Once we save our build definition is ready.
We can queue a test build by right clicking on the build definition and click on Queue New Build.

Double click on this will open detail view.
Our CI build is done. (Ignore the time taken to build, my build server is having only 512MB RAM and TFS server only 2 GB of RAM, it will be much faster in a virtual/physical environment with more resources :))
Now let’s do a code change and check in to see if a new build triggers. Assume I have a bug to fix :)
So let’s do the fix.
We do the change
Then check in while resolving/closing the task.
Check in has triggered a build and it is done.

We can see our work items (task and Bug) associated correctly to the build.
The task is set to closed automatically.
We can resolve the Bug now.
Next I will explain how to create a release build with a build out put.
Let’s create very simple Asp.Net Web Forms application first. Here I do nothing but use the template to create a simple app.
First a VS Solution.
Next add a ASP.Net Web Forms Application.
Now we have a basic Asp.Net Forms Application up and running.
Let’s check in this to TFS.
Now we have a simple application checked in to TFS.
Our next goal is to set up a CI Build, which builds for each changeset we check in. A new build definition can be created by navigating to Builds from Team Explorer Home, and clicking on New Build Definition.
Build name specified as “DemoWS.CI”.
In the trigger we have to set as Continuous Integration to make the build trigger for every check in.
Source settings we have to specify the correct source mapping.
We do not want to create any output from this CI build. We are just making sure our code is in a valid state and compile without errors.
In the Process tab of build definition we specify solution to build and we are setting build agent tags to correctly locate the build agent.
We are setting at least a build agent with VS2013 available should be located when the build is triggered.
Configuration to build we are selecting in this demo is Release and Any CPU.
We do not want to keep all successful builds in a CI build, since this is just a verification of latest source state of success compilation.
Once we save our build definition is ready.
We can queue a test build by right clicking on the build definition and click on Queue New Build.
Build is just started
Double click on this will open detail view.
Our CI build is done. (Ignore the time taken to build, my build server is having only 512MB RAM and TFS server only 2 GB of RAM, it will be much faster in a virtual/physical environment with more resources :))
Now let’s do a code change and check in to see if a new build triggers. Assume I have a bug to fix :)
So let’s do the fix.
We do the change
Then check in while resolving/closing the task.
Check in has triggered a build and it is done.
We can see our work items (task and Bug) associated correctly to the build.
The task is set to closed automatically.
We can resolve the Bug now.
Next I will explain how to create a release build with a build out put.
Wednesday, 8 May 2013
Why CI Build
There is lot of talk on CI builds nowadays. Have you ever thought why it has become a hot topic? Or is it really important? What is the benefit of it? OK to answer all above I will take you through a very simple demo with even simpler sample.
For simplicity let's say we only have two developers in our team. The Developer A and the Developer B. They both are working on a windows forms application referring to a class library from that.
Our Developer A starts development and he creates a method "GetWelcomeMessage" in Class1. Then he uses it in his Form1 he is developing in the Windows Application.
Developer A compiles this code successfully and checks-in the Class1 and Form1. Now the source control server (TFS) has the files as below.
Now our Developer B takes the latest version from source control server and he adds another form, Form2 and use the method developed by Developer A.
Developer B compiles his code successfully in his development PC and checks-in the code. Now the server copy will be like below.
The source control server (TFS) now have the code checked-in by both Developer A and Developer B. This source code is valid and compiles without any issue if latest version is downloaded to any of the developers' PCs.
Now our Developer A becomes a little bit lazy next day morning and do not bother to get the latest version from the server. So he still has only Form1 and the Class1 in his solution.
Developer A starts modifying code from yesterday WITHOUT getting the latest version from source control server. He changes Class1 "GetWelcomeMessage" method to accept a parameter (username) and include that in the return message. Then he modifies the Form1 method call to Class1."GetWelcomeMessage" to send the username.
The Developer A compiles the code in his development PC, and it looks good and compiles successfully. Developer A checks-in the modified Class1 and Form1 code to the source control server(TFS).
Now what is the status of the code in source control server. The Developer A has checked-in set of changes which is causing build errors in the solutions latest copy in the source control server.
Now if developer A or B download the latest version from source control server, none of them will be able to compile the solution. If both of them lazy enough to not to get the latest version, they will keep on developing and adding new files for their respective tasks without knowing about the errors in the latest copy of the solution. May be they will discover this just before, when they try to release to QA.
Wouldn't it be nice to have someone who compiles the source code checked-in to the Source Control Server (TFS) and alert the two Developers A,B about the broken build status, and the changes that caused the build break.
Exactly that is the job of a CI build in TFS world. CI build will build the Source Control Server version of the source code for each checked-in, change-set and alert if there is any build failures. This will give lot of benefit to the developers to easily identify the issue in the build by detecting the change-set caused the build break.
In my next post I will explain how to setup a CI build , for a solution with TFS 2012 & VS 2012.
For simplicity let's say we only have two developers in our team. The Developer A and the Developer B. They both are working on a windows forms application referring to a class library from that.
Our Developer A starts development and he creates a method "GetWelcomeMessage" in Class1. Then he uses it in his Form1 he is developing in the Windows Application.
Developer A compiles this code successfully and checks-in the Class1 and Form1. Now the source control server (TFS) has the files as below.
Now our Developer B takes the latest version from source control server and he adds another form, Form2 and use the method developed by Developer A.
Developer B compiles his code successfully in his development PC and checks-in the code. Now the server copy will be like below.
The source control server (TFS) now have the code checked-in by both Developer A and Developer B. This source code is valid and compiles without any issue if latest version is downloaded to any of the developers' PCs.
Now our Developer A becomes a little bit lazy next day morning and do not bother to get the latest version from the server. So he still has only Form1 and the Class1 in his solution.
Developer A starts modifying code from yesterday WITHOUT getting the latest version from source control server. He changes Class1 "GetWelcomeMessage" method to accept a parameter (username) and include that in the return message. Then he modifies the Form1 method call to Class1."GetWelcomeMessage" to send the username.
The Developer A compiles the code in his development PC, and it looks good and compiles successfully. Developer A checks-in the modified Class1 and Form1 code to the source control server(TFS).
Now what is the status of the code in source control server. The Developer A has checked-in set of changes which is causing build errors in the solutions latest copy in the source control server.
Now if developer A or B download the latest version from source control server, none of them will be able to compile the solution. If both of them lazy enough to not to get the latest version, they will keep on developing and adding new files for their respective tasks without knowing about the errors in the latest copy of the solution. May be they will discover this just before, when they try to release to QA.
Wouldn't it be nice to have someone who compiles the source code checked-in to the Source Control Server (TFS) and alert the two Developers A,B about the broken build status, and the changes that caused the build break.
Exactly that is the job of a CI build in TFS world. CI build will build the Source Control Server version of the source code for each checked-in, change-set and alert if there is any build failures. This will give lot of benefit to the developers to easily identify the issue in the build by detecting the change-set caused the build break.
In my next post I will explain how to setup a CI build , for a solution with TFS 2012 & VS 2012.
Subscribe to:
Posts (Atom)
Popular Posts
-
Can a Coded UI test executed with a Console Application? Yes it is possible. I am going to explain how it can be done. I am going to exec...
-
The hosts file in /etc/hosts is allowing the WSL distros to map IP addresses to domain names before going to domain name servers, similar...
-
You might encounter compilation error in Visual Studio 2015 when a new .NET Core 1 web app is created, if you have installed Visual Studio 2...
-
Sometimes it takes long time to copy files from drop folder to the lab environment when you have your lab environment in different locations...
-
This extension “ Chamindac.vsts.release.task.download-artifacts ” for VSTS and TFS 2015.2.1 upwards, can be used to filter for build artifac...







