Tag Archives: CI

Setting up a standalone TFS with CI and automated deployment (Part 2)

In my previous post, we looked at setting up a standalone instance of TFS.  In this post, let’s look at setting automated builds in TFS.

 

Goal: Configure Build Service / Controller / Agents

  1. Open Team Foundation Server Administration Console.
  2. Navigate to the “Build Configuration” node, and stop your Build Service.
  3. Remove all controllers and agents if they were previously set up.
  4. Click Properties, then point the Build Controller to your Team Project Collection.
  5. Start the Build Service
  6. Click New Controller, and set up your build controller. Disable/Enable/Refresh for the build controller to come online.
  7. Click New Agent, and set up your build agent.
  8. Open Team Explorer and connect to your Project.
  9. Right click on “Builds”, then “Manage Build Controllers”.  The Build Controller and Agent(s) should be visible.image

Achievement: Your build controllers and agents are set up.

Goal: Set up Custom Build Qualities

  1. Open Team Explorer and connect to your Project.
  2. Right click on “Builds”, then “Manage Build Qualities”.
  3. Add/Remove the list of Quality Namesimage

Achievement: You have set up build qualities to reflect your deployment workflow.  These will later be used to track and even trigger automatic deployments.

 

Goal: Preparing for build and deployment

  1. Open solution, and select the select Web Application Project File.
  2. Right click on the web project, select properties.  Open the Package/Publish Web tab.
  3. Ensure that “Create deployment package as a zip file” is checked.
  4. Ensure that “IIS Web site/application name to use on the destination server” is set up to the value that you want.  This will save you a lot of pain later.image

Achievement: You have configured the target location of your deployment.  This will be preconfigured when you build the project into a package.

 

Goal: Create drop/symbol folders

  1. Create a directory where successful build are copied to.  This will also be the source location that your subsequent deployment go out from.  I made mine in C:\Build
  2. Share this folder, and ensure that the account that runs the build service has access to this share.  In my case, the service account is the SYSTEM account.
    image
  3. Create a directory where successful build are copied to. This will also be the source location that your subsequent deployment go out from. I made mine in C:\Symbols
  4. Share this folder, and ensure that the account that runs the build service has access to this share. In my case, the service account is the SYSTEM account.
    image

Achievement: You have configured the necessary shared folders for your builds.

 

Goal: Create a New Build Definition

  1. Open Team Explorer and connect to your Project.
  2. Right click on “Builds”, then “New Build Definition”.
  3. Under the Trigger tab, set it to manual.  You can change it later when everything is done.
  4. Under build defaults, set up the drop location.image
  5. Under Process, set up the project(s) and build configurations.  My settings happen to be as follows:
    – Configurations to build: Any CPU|Debug, Any CPU|Release
    – Clean Workspace: None
    – Path to Publish Symbols: \Symbols">\Symbols">\Symbols">\\<servername>\Symbols
    – MSBuild Arguments: /p:CreatePackageOnPublish=true /p:DeployOnBuild=true
    image
  6. Save your Build Definition.

Achievement: You have defined a build definition.

Goal: Check your Build Definition

  1. From the Team Explorer, right click on your new build definition, select “Queue New Build”, then “Queue”.
  2. Wait for the server to perform the build and hopefully you are rewarded with the Green OK icon!
  3. Check the location where your build agent performs the build, you should see a similar structure.
    image
  4. Check the drop location, you should see a similar structure.
    image
  5. Check the symbol folder, you should see a similar structure.
    image
  6. You can directly take the package and import it to your web server.
  7. You can also set the build quality of your builds directly from the screen.  We’ll soon look at how setting this quality can trigger a deployment to your target servers.
    image

Achievement: You have performed a build via TFS.  Now you can configure the triggers to suit your needs.

Advertisements

Setting up a standalone TFS with CI and automated deployment (Part 1)

I’ve been spending the past week smashing my head against the wall as I struggled to set up a standalone TFS with CI, and web deployment.  I hope that sharing this multipart series of my little adventure will help someone along the way. 

Goal: Setup standalone TFS on a Windows Server 2008R2 SP1 VM

  1. Read through these steps before commencing.
  2. Ensure that your VM has at least 50GB HDD with 2GB ram.  This setup uses about 30GB after installation.
  3. Ensure that you have the following installation media:
    – Windows Server 2008R2 and necessary SP patches
    – Microsoft SQL 2008R2 and necessary SP patches
    – Microsoft VS2010 and necessary SP patches
  4. Install Microsoft OS and patches.
  5. Setup the IIS Role, with web management features.  (Always install IIS before installing .NET 4.0, it saves you some pain).
  6. Setup your server name, network ports and connections.
  7. Create a standard account: TFSServiceAccount
  8. Create a group: TFSBuilders
  9. Create a group: TFSDevelopers
  10. Install Microsoft SQL 2008R2 with reporting services / full-text search / analysis services, and necessary patches.  This step will save you a lot of pain.
  11. Install Microsoft TFS and necessary patches.  Use the TFSServiceAccount when prompted.
  12. Install Microsoft  VS2010 / Team Explorer and necessary patches.  This may be optional, but I felt it was useful when setting up the user accounts later.  YMMV.

Achievement: You have a new TFS Server.

Goal: Creating a Team Project Collection / Project

  1. Open Team Foundation Server Administration Console
  2. Under the Team Project Collections node, click Create Collection.
  3. Complete the wizard,and wait for the various components to be setup
  4. Open VS2010 / Team Explorer and connect to TFS, and the new Project Collection.
  5. Right click on the Project Collection and create a Project with default selections.
  6. Right click on the new project, then Team Project Settings, then Group Membership.
  7. Select the Builders TFS Group, then click Properties.
  8. Add the TFSBuilders group as a member. 
  9. Select the Contributers TFS Group, then click Properties.
  10. Add the TFSDevelopers group as a member.

Achievement: You have a new project created under a new Team Project Collection, and configured it such that when you create a user, and add them to the appropriate Windows Groups, they will be able to perform the corresponding actions.

 

Goal: Setup Project Sharepoint Site

  1. Login as Administrator to your Project Sharepoint Site at http://<ServerName>/sites/<ProjectCollection>/<ProjectName&gt;
  2. Select Site Settings from the Site Actions
  3. Click People and groups
  4. Click New. The Add Users page appears.
  5. Add the TFSBuilders group with the necessary permissions, then click OK.
  6. Repeat with the above steps for the TFSDevelopers group.

Achievement: Now, when you create a new user, and add them to one of the groups, they will be able to access the Project Sharepoint Site.

 

Goal: Setup Project Reporting Site

  1. Login as Administrator to your Project Report Site at http://<ServerName>/Reports/Pages/Settings.aspx
  2. Select Security
  3. Click New Role Assignment.
  4. Add the TFSBuilders group with the necessary roles, then click OK.
  5. Repeat with the above steps for the TFSDevelopers group.

Achievement: Now, when you create a new user, and add them to one of the groups, they will be able to access the Project Report Site.

 

Goal: Setup a TFS Developer Account (Person that will develop and check in code)

  1. Create a user account.
  2. Add the user account to the the TFSDevelopers group.

Achievement: You have set up an account that will be able to access the TFS code store under the project, as well as access Sharepoint and report resources.

 

Goal: Setup a TFS Builder Account (Person that will help perform builds and deployments)

  1. Create a user account.
  2. Add the user account to the the TFSBuilders group.

Achievement: You have set up an account that will be able to perform code builds  and trigger deployments under the project, as well as access Sharepoint and report resources.

 

Goal: Setup source control

  1. Using VS2010 / Team Explorer, connect to the Project.
  2. Double click on Source Control to open the Source Control Explorer
  3. Right click on the Project node and select Map to Local Folder, then provide a location to map. This anchors the source control and enables you to create folders and add files.image
  4. Right click on the Project node to add more folders/files, as per your source control directives.
  5. Remember to check in.

Achievement: You have set up the source control.

 

Please give comments on how these steps can be improved, or highlight steps that did not work for you (and hopefully the accompanying solutions).