2015 Ignite New Zealand demo prep: Step 2

Steps:

  1. Intro
  2. VSO
  3. Docker
  4. xUnit
  5. Build
  6. Back end
  7. Selenium
  8. Docker
  9. Release Management
  10. Testing

To set up this demo you are going to need:

Once you have setup all the items above we can start building our demo.

  1. Create a Team Project in your Visual Studio Online account
    1. Click New under Recent projects & teams from the Overview page

    2. Enter Name
    3. Enter Description
    4. Select Process template
    5. Select Git for Version control

    I only selected Git because of its popularity and it gave me the opportunity show our Pull request support. TFVC is not going away and is still a valid source control choice.

    To save some time, we are going to simply spin up a VM in Azure that already has Visual Studio installed. I will be using Visual Studio Community 2015 with Azure SDK 2.7 on Windows Server 2012 R2 machine.

  2. Create VM in Azure with Visual Studio installed
    1. Open the Azure Preview Portal
    2. Click Add button

    3. Click Compute
    4. Click Marketplace
    5. Search for “Visual Studio 2015”
    6. Select “Visual Studio Community 2015 with Azure SDK 2.7 on Windows Server 2012 R2”
    7. Click Create
    8. Enter Host name
    9. Enter User name
    10. Enter Password
    11. Click Create

    The first thing we are going to do is install the build agent on this machine.

  3. Remote desktop into your VM
    1. Locate VM in Azure Preview Portal
    2. Click the Connect

  4. Download Agent from VSO
    1. Open Internet Explorer
    2. Navigate to your VSO account
    3. Click the Administer Account gear in the upper right hand corner of the screen
    4. Select Control panel
    5. Click Agent pools tab
    6. Click the Download agent link
    7. Save the file to your Downloads folder
    8. Right-click agent.zip
    9. Select Properties
    10. Ensure the file is unblocked
  5. Extract the file to Agent1 folder
    1. Right-click agent.zip
    2. Select Extract All
    3. Enter C:\Agent1
    4. Click Extract

    I number my folders because you can have multiple agents installed on a single machine. I tend to install one agent per core.

  6. Run ConfigureAgent.cmd in elevated command prompt
    1. Press the Windows key
    2. Type CMD
    3. Right-click Command Prompt
    4. Select Run as administrator
    5. Navigate to the folder where you extracted the file contents
    6. Run ConfigureAgent.cmd
    7. You can either use the default name or have the name match the folder name, which in my case is Agent1
    8. Now enter your Visual Studio Online URL
    9. Enter the agent pool to which you would like to add this agent.
      1. Every Visual Studio Online account is created with two Agent Pools: Default and Hosted.  You are free, however, to create additional agent pools from the page where you downloaded the agent.
    10. Accept the default working folder
      1. You have a choice to decide where you would like the agent to store the files it will be working with during builds and releases.
    11. Answer N
      1. Because we are going to be running Selenium tests we will want to run the agent in interactive mode.
    12. Sign in to your Visual Studio Online account

    After you log in, the agent will be configured and begin running.  If you return to your Visual Studio Online account you will see your new agent listed.

    Next we are going to configure our machine to automatically sign in and start the agent. This will ensure that if our machine is rebooted for service updates our agent will restart. This is also required to ensure our Selenium tests will run successfully after a reboot of the machine.

  7. Enable automatic log in
    1. Open the Run dialog
      1. Press Windows Key + R
    2. Type “control userpasswords2”
    3. Press enter
    4. Uncheck the box for “User must enter a user name and password to use this computer.”
    5. Click the Apply button
    6. Enter the password for the user
    7. Click OK
    8. Click OK on the Users Accounts dialog

    Now, every time your machine is rebooted the configured user will automatically log in to the machine.

    Now we need to make sure that once the user is logged in that our agent starts in interactive mode. To do this we are going to create a shortcut that will start our agent, then simply place that shortcut in the startup folder for Windows.

  8. Create shortcut in Startup folder
    1. Right-click the desktop
    2. Select New / Shortcut
    3. In the Create Shortcut dialog enter “cmd”
    4. Click Next
    5. Change the name to “Start Agent”
    6. Click Finish
    7. Right-click on the new shortcut
    8. Select Properties
    9. Append “/c {pathToVsoagent.exe}” to the target
      1. If you installed your agent to C:\Agent1, your target should look like this: C:\Windows\System32\cmd.exe /c c:\agent1\agent\vsoagent.exe
    10. Click OK

    If you double click the shortcut, your agent will start in interactive mode. Now we need to copy this shortcut into the startup folder for Windows. This will ensure that each time we log in the agent will be started.

  9. Copy Short cut to startup folder
    1. Open the Run dialog
      1. Press Windows Key + R
    2. Type “shell:startup“
    3. Press enter
      1. This will open the startup folder in Windows Explorer
    4. Drag and drop the shortcut to this folder

    Now, whenever your machine is restarted your agents will start up in interactive mode.

With the agent installed and the machine configured, we can move onto the next step.

Comments (4) -

  • sam
    Thanks Donovan for you explanation and looking forward to the other steps. I saw your presentations Ignite in NZ and they were awesome.
  • sam
    Hi Donovan, I have followed these steps now I'm trying to figure out how to get the selenium tests executed during build.. is that the next step you will go into greater detail? I kind of need it asap.. cheers
    • I am writing them when time permits.  You run Selenium test using our out of the box test task. Just make sure you follow my post on how to make sure your agent auto logs in and you should be good.
      • sam
        Thanks Donovan, I eventually worked it out. Cheers

Pingbacks and trackbacks (29)+

Add comment

Loading