Impressions on installing TFS “15” Preview

Microsoft released a preview of the new version of Team Foundation Server, codename TFS “15” and as usual I immediately downloaded and installed on some of my test server. I’m not going to show you full steps of installation or upgrade, because installing TFS is now a Next/Next/Next experience, but I want to highlight a couple of really interesting aspect of the new installer.

Support to Pre-Production environment

When it is time to upgrade your TFS production server, it is always a good practice to perform the upgrade in a pre-production environment, to avoid having surprises upgrading production instance. Traditionally this is a not so immediate task, because you need to backup and restore database to a test server, then run some command line instructions to change the id of the server in db and then perform the upgrade.

I’ve done a post in the past on how to create a safe clone of your TFS Environment and I suggest you to have a read of that post, but with the new version of TFS installer, when you choose the upgrade path, you have this new screen

image

Figure 1: You can choose to create a pre-production test directly from Wizard

This is a really big improvement, because now you can simply backup and restore your databases on a new server, run the wizard, choose to do a pre-production Upgrade Testing and you have a clone of you server upgraded to the new version where you can do all of your tests to verify the upgrade process.

Thanks to Pre-Production Upgrade Testing option, creating a test clone of your server where to perform the upgrade is a breeze

This option is not only useful for upgrades, but allows you to quickly create a clone of your TFS to do whatever experiment you want to do with real Production data, without harming your production server.

Great work Microsoft!!

Code search and ElasticSearch

Another interesting wizard screen is the one dedicated to installing code Search capabilities.

image 

Figure 2: Code search installing screen

Code search was introduced in VSTS lots of time ago, but now is available even on TFS installation. It uses ElasticSearch under the hood, but the installer takes care of everything for you. From Figure 2 you can see that you only need to specify a folder where to store the index, and choose if you want to enable code search for every project collection and the game is done.

Sadly enough, you are not allowed to use an exising installation of ElasticSearch, here is the error you got if you already have ES installed on the machine.

image

Figure 3: You cannot re-use an existing ES installation

You should uninstall every installation of ES you have if your machine before installing code search capabilities. Since ES depends on Java, if you do not have Java JRE or JDK installed on the machine the wizard gives you an error during the verification process.

image

Figure 4: An error is present if your machine has no Java installed

You can check the box where you accept the Oracle Binary Code License Agreement and the installer will download and install Java for you, or you can simply download and install Java manually, then re-run the Readiness Checks. If you are going to do a manual install of Java or if you have a pre-existing Java installation please check in ES site if your version is compatibile or have some problem.

Usually you have no Java in your TFS Box, so it is safe to check the checkbox and have the installer do everything for your automatically.

SSH Support

To support SSH Protocol for Git, you should tell the installer that you want to enable the SSH Service and choose the port (22 by default)

image

Figure 5: SSH Support in TFS for Git

As TFS Evolves the Configure / Upgrade Wizard is more and more complete, and allows you to istall TFS without leaving the Wizard, and configuring / installing all dependent services for you.

Gian Maria.

Create a release in TFS 2015 / VSTS Release Management

This is the end of the journey of the last serie of posts. I’m now at the situation where I have a build that produces a single zip file with everything I need to deploy the software and a bunch of PowerShell scripts that relase the software using that zip as a source artifact.

Now it is time to automate the process with Release Management. I want to use RM because the process is automated on a chain of environments, but also I have traceability, auditing, and verification of the release procedures. I’m not going to cover all the steps needed to create the a release definition, I want to focus on how simple is creating a Release Process when you adopt Zip+PowerShell approach. I strongly suggest to have a look at official site if you never heard of VSTS / TFS Release Management.

If you have a zip and PowerShell files that release the software using only the zip, you are ten minutes away from a working Release Management definition

Let’s start creating a first release, the most important aspect is adding a build as Artifacts source, this allows the release to consume what is produced by the build.

this image shows how a build can be linked to Release MAnagement, so the RM process can access artifacts produced by the build

Figure 1: Add your build as a artifacts source for the release process

This build produces a couple of artifacts, the zipped file with everything and the set of PowerShell scripts needed to run the software (as I suggested they should always be stored in source control and moved as build artifacts). Thus the release process is really simple and is composed by only three steps.

The entire release process is only three task, as described further in the post.

Figure 2: The entire release process is composed only by three scripts

First two steps are used to copy zip file and installation scripts in a folder of the target machine (c:\deploy\jarvis\…). as you can see I’m using local administrator user, so this technique can be used even if the machine is not in the domain. You should now run this script on the machine where the agent is running.

Set-Item WSMan:\localhost\Client\TrustedHosts -Value WebTest -Force

This instruction should be run to the machine where the build agent is running, and specify that the target machine is a Trusted Hosts. If you are using domain credentials, this is not needed.

The password is stored inside a Release variable, to use secret variable feature, so noone that can edit this release can see the password in clear text.

Password for target machine is stored as secret variable in Configuration section

Figure 3: Password for target machine is stored as secret variable in Configuration section

Final step in Figure 2 is using the task to run the installation script in a remote machine machine.

This image shows the configuration of the Remote Powershell task that allows you to execute a powershell in a remote machine.

Figure 4: Run PowerShell in a remote machine to install software

If you already tested the script manually, there is no reason why it should fail in RM process. Remember that you should never use command that interact with the shell, and you should use Write-Output instead of Write-Host in your PowerShell script to be sure that no shell is used.

With only three task I’ve created a release definition for my software

Now you can trigger a new release, or have each build trigger a new release on the dev machine. The really interesting aspect is, using GitVersion and GitFlow, when you select the build you want to release, you can choose the branch you want to deploy instead of understanding what is in a build from its number.

Thanks to gitversion when you trigger a new release you can choose the build that you want to deploy, and you can choose using a semantic versioning like 1.5.0 or 1.5.0-beta1 instead that a generic build number

Figure 5: Trigger a release manually allows to specify the build you want to release

Ad you can see from Figure 5, you can easily choose the version of the software you want to release, it is really clear from the name of the build. Once the Release is started, if the deploy is set to occur automatically, the release immediately starts

This image simply shows that the release is in progress

Figure 6: Relase is in progress

Once the release is in progress, from the summary you can verify what version of the software is released in what environment. I have only one environment for this demo, and I can verify that 4 minutes ago the version 1.5.0 is deployed in that environment.

This image shows all releases done with this definition. New release of version 1.5.0 was completed 4 minutes ago

Figure 7: New release was deployed successful

I can now verify that the new version was really deployed correctly opening the software in target machine.

Opening the software the new version confirm that the deploy was really successful

Fgiure 8: New version of the software is correctly deployed

Once you have everything in place and use simple PowerShell approach, setting up a release management process is really straightforward.

Gian Maria.

Execute powershell code during a build in TFS 2015 Update 2

In TFS 2015 build system, running a PowerShell script stored in source code is simple because there is a dedicated action to accomplish this task, but if you want to run a PowerShell script that is not in source control, you have no option out of the Box.

Thanks to Update 2, you have now the ability to use the extensions you can find on Visual Studio Marketplace directly in your on-premise TFS installation. In the Upper Right corner of Web Ui you can find an icon that link to

This image shows the link in TFS UI to open the control panel to manage extension.

Figure 1: Link to manage extensions

This opens an administration page that allows you to manage extensions of your TFS installation. The first time you open this page, you will see no extension installed, so it is time to browse Visual Studio MarketPlace to find an extension. Actually I want to run inline PowerShell and I can immediately find that there is an extension that can solve my need.

As you can see from Figure 2, this extension have a couple of button, the first one, Install, is used to install this extension on one of your VSTS account, but if the extension is compatible with on-premise TFS you have also the option to Download the extension.

This image shows that extensions can be downloaded to local pc to be installed to TFS

Figure 2: Once you find an extension compatible with on-premise TFS you can download it.

The extension is a simple .vsix file, and from extension administration page you can upload to your TFS.

This image shows how you can upload downloaded extension to your TFS instance.

Figure 3: Once downloaded you can upload the extension to your TFS.

The process of uploading is really simple:

This image shows how you can choose the file to upload

Figure 4: Browse for downloaded extension

Tfs shows info for file to upload

Figure 5: Upload UI shows all the detail of the file

Now you can press Upload button, and the extension is uploaded to TFS and ready to be activated.

TFS shows the list of uploaded and installed extensions

Figure 6: Uploaded extension is now listed in the list of available extension

For each extension TFS ask you to install in specific project collection

  1. Figure 7: Install the extension on one or more collection

The concept behind “install then activate” is that, once uploaded the extension is available for the TFS Server instance, but then you should install in each Project Collection where you want to use that extension.

TFS asks you to choose the collection where you want to use the extension.

Figure 8: Choose the collection you want to install the extension into

Once you choose the Project Collection you need to confirm the operation

Figure 9: Confirm the selection

Once the Extension is installed in one Project Collection it can be used. In this example the extension contains a new build Task that allows you to execute an arbitrary PowerShell script during the build. To verify that everything is ok you can create a build and verify that the new Task is available and ready to use.

the extension is used in a build, where I was able to add the new task that executes arbitrary powershell code

Figure 10: The extension is ready and can be used

Thanks to TFS 2015 Update 2 you can Download and install extension for VSTS Marketplace to your on-premise TFS installation with few clicks.

Gian Maria.

Add Reporting to an existing Team Project

In previous post I demonstrated how you can create a Team Project from Web Interface thanks to TFS 2015 Update 2. The only drawback of this approach is that no Sharepoint Site and no Reporting Services portal are created.

While SharePoint integration is now an uncommon requirement, reporting services are still used. After my new Team Project (namedTest Project 2 ) was created from web interface, I verified that nothing gets created in my Reporting Services instance.

image

Figure 1: No reporting was created for new Team Project

Thanks to TFS Power Tools you are able to create both SharePoint portal and Reporting services for an existing project.

You can add reporiting with the tfpt.exe power tools command line utility. As an example here is the help for the addprojectreports command, used to create reports for an already created Team Project.

This image shows the list of options available to the addprojectreports command.

Figure 2: Help of the addprojectreports command

This is the exact command line I need to recreate reports for my Team Project is:

tfpt addprojectreports 
	/collection:http://tfs.cyberpunk.local:8080/tfs/ExperimentalCollection 
	/teamproject:"Test Project 2"
 	/processTemplate:"CMMI"

After a little while tfpf.exe created everything as I can verify from Reporting Services Site, now I have the usual folder for the Team Project that contains all Reports.

After tfpf addprojectreports command all reports for the team project are correctly created in Reporting Services Site

Figure 3: Reports were created for the Team Project

The same can be done with SharePoint portal. Thanks to Power Tools you can create the Team Project directly from the Web Site and add portal or reports subsequently and only if you need them.

Gian Maria.

TFS 2015 Update 2 is released

You can find all the details directly in Visual Studio Site, but I want to emphasize that TFS and VS Updates are much more than Service Packs, because they also intrdoduce a lot of new features. Here is a list of my personal favorites features of TFS Update 2

Introduction of new Release Management System

New release management system is completely Web and does not require separate client to download, but this is not the only advantage. This update introduces the ability to integrate with VMWare, and have a new extension to connect to System Center Virtual Machine Manager.

Delete of work item from the UI

This solves probably the most common question I got during TFS Courses. Basically every attendee asks “how can I delete Work Item?”. The usual answer is, you need to resort to Command Line utility, because deleting a Work Item actually deletes its history from database and its a dangerous operation to do.

This is not always true, there are lots of legitimate reasons to delete a Work Item and now it is possible to delete Work Items directly from the Web Interface. Deletion actually move Work Items to a Recycle Bin where you could still restore deleted Work Items or delete permanently.

Extension from marketplace

This is another really cool feature, Marketplace was available until now, only for VSTS accounts, but now you can add extensions even to your TFS on premise instance.

Gated Check-in for new build system

This was another great stopper for customer to adopt the new build system, until Update 2 the new build system has no support for Gated Check-in. With Update 2 you can create a Gated Check-in TFVC vNext build

New Link from Git Code and Work Items

Now you can link a work item not only to a Commit in Git but also to an entire branch. This is really interesting if you work with GitFlow and are used to feature branches. With this approach you can link each PBI or User Story directly to Git Feature branch that is implementing it.

This is especially useful for Scrum Team, because you can create a pull-request for all Completed User Stories of the Sprint, and do a review. Then, during Sprint Review, you can complete pull requests only for those User Stories that are considered completed by the Product Owner. All the User Stories that are still not considered completed will flow to the Next Sprint, postponing the Merge.

I strongly encourage you to have a look at the full list of the new feature, and, as always, I strongly suggest you to always upgrade your TFS to the latest version, to have all the latest bugfix and to avoid Big Bang upgrade that spans multiple versione (ex 2008 to 2013, or 2010 to 2015).

Gian Maria.